layout/style/test/test_descriptor_syntax_errors.html

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 -->
michael@0 5 <head>
michael@0 6 <title>Test that we reject syntax errors listed in descriptor_database.js</title>
michael@0 7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 8 <script type="text/javascript" src="descriptor_database.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 10 </head>
michael@0 11 <body>
michael@0 12 <p id="display"></p>
michael@0 13 <div id="content" style="display: none">
michael@0 14 </div>
michael@0 15 <pre id="test">
michael@0 16 <script class="testbody" type="text/javascript">
michael@0 17
michael@0 18 var gStyleElement = document.createElement("style");
michael@0 19 gStyleElement.setAttribute("type", "text/css");
michael@0 20 document.getElementsByTagName("head")[0].appendChild(gStyleElement);
michael@0 21 var gSheet = gStyleElement.sheet;
michael@0 22 gSheet.insertRule("@font-face { }", 0);
michael@0 23 var gRule = gSheet.cssRules[0];
michael@0 24 var gDeclaration = gRule.style;
michael@0 25
michael@0 26 function fake_set_property(descriptor, value) {
michael@0 27 gSheet.deleteRule(0);
michael@0 28 gSheet.insertRule("@font-face { " + descriptor + ": " + value + "}", 0);
michael@0 29 gRule = gSheet.cssRules[0];
michael@0 30 gDeclaration = gRule.style;
michael@0 31 }
michael@0 32
michael@0 33 for (var descriptor in gCSSFontFaceDescriptors) {
michael@0 34 var info = gCSSFontFaceDescriptors[descriptor];
michael@0 35 for (var idx in info.invalid_values) {
michael@0 36 var badval = info.invalid_values[idx];
michael@0 37
michael@0 38 // // We don't implement SetProperty yet (bug 443978).
michael@0 39 // gDeclaration.setProperty(descriptor, badval, "");
michael@0 40 fake_set_property(descriptor, badval);
michael@0 41
michael@0 42 is(gDeclaration.getPropertyValue(descriptor), "",
michael@0 43 "invalid value '" + badval + "' not accepted for '" + descriptor +
michael@0 44 "' descriptor");
michael@0 45
michael@0 46 gDeclaration.removeProperty(descriptor);
michael@0 47 }
michael@0 48 }
michael@0 49
michael@0 50 </script>
michael@0 51 </pre>
michael@0 52 </body>
michael@0 53 </html>

mercurial