content/base/test/test_bug418214.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=418214
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 418214</title>
michael@0 8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=418214">Mozilla Bug 418214</a>
michael@0 13 <p id="display"></p>
michael@0 14 <div id="content" style="display: none">
michael@0 15
michael@0 16 </div>
michael@0 17 <pre id="test">
michael@0 18 <script class="testbody" type="text/javascript">
michael@0 19
michael@0 20 var str = '<root xmlns:html="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:math="http://www.w3.org/1998/Math/MathML"><html:div id="d" style="border:: invalid"/><svg:svg id="s" style="border:: invalid"/><math:math id="m" style="border:: invalid"/></root>';
michael@0 21
michael@0 22 /** Test for Bug 418214 **/
michael@0 23 var doc = (new DOMParser()).parseFromString(str, "text/xml");
michael@0 24 var d = doc.getElementById("d");
michael@0 25 var s = doc.getElementById("s");
michael@0 26 var m = doc.getElementById("m");
michael@0 27
michael@0 28 is(d.getAttribute("style"), "border:: invalid",
michael@0 29 "Shouldn't be parsing style on HTML in data documents");
michael@0 30 is(s.getAttribute("style"), "border:: invalid",
michael@0 31 "Shouldn't be parsing style on SVG in data documents");
michael@0 32 is(m.getAttribute("style"), "border:: invalid",
michael@0 33 "Shouldn't be parsing style on MathML in data documents");
michael@0 34
michael@0 35 var d2 = d.cloneNode(true);
michael@0 36 var s2 = s.cloneNode(true);
michael@0 37 var m2 = m.cloneNode(true);
michael@0 38
michael@0 39 is(d2.getAttribute("style"), "border:: invalid",
michael@0 40 "Shouldn't be parsing style on HTML on clone");
michael@0 41 is(s2.getAttribute("style"), "border:: invalid",
michael@0 42 "Shouldn't be parsing style on SVG on clone");
michael@0 43 is(m2.getAttribute("style"), "border:: invalid",
michael@0 44 "Shouldn't be parsing style on MathML on clone");
michael@0 45
michael@0 46 d2.style;
michael@0 47 s2.style;
michael@0 48 m2.style;
michael@0 49
michael@0 50 is(d2.getAttribute("style"), "border:: invalid",
michael@0 51 "Getting .style shouldn't affect style attribute on HTML");
michael@0 52 is(s2.getAttribute("style"), "border:: invalid",
michael@0 53 "Getting .style shouldn't affect style attribute on SVG");
michael@0 54 is(m2.getAttribute("style"), "border:: invalid",
michael@0 55 "Getting .style shouldn't affect style attribute on MathML");
michael@0 56
michael@0 57 d2.style.color = "green";
michael@0 58 s2.style.color = "green";
michael@0 59 is (m2.style, undefined, ".style shouldn't exist on MathML");
michael@0 60
michael@0 61 is(d2.getAttribute("style"), "color: green;",
michael@0 62 "Adjusting .style should parse style on HTML");
michael@0 63 is(s2.getAttribute("style"), "color: green;",
michael@0 64 "Getting .style should parse style on SVG");
michael@0 65
michael@0 66 d = document.adoptNode(d);
michael@0 67 s = document.adoptNode(s);
michael@0 68 m = document.adoptNode(m);
michael@0 69
michael@0 70 is(d.getAttribute("style"), "border:: invalid",
michael@0 71 "Adopting should not parse style on HTML");
michael@0 72 is(s.getAttribute("style"), "border:: invalid",
michael@0 73 "Adopting should not parse style on SVG");
michael@0 74 is(m.getAttribute("style"), "border:: invalid",
michael@0 75 "Adopting should not parse style on MathML");
michael@0 76
michael@0 77 $("display").appendChild(d);
michael@0 78 $("display").appendChild(s);
michael@0 79 $("display").appendChild(m);
michael@0 80
michael@0 81 is(d.getAttribute("style"), "border:: invalid",
michael@0 82 "Adopting should not parse style on HTML");
michael@0 83 is(s.getAttribute("style"), "border:: invalid",
michael@0 84 "Adopting should not parse style on SVG");
michael@0 85 is(m.getAttribute("style"), "border:: invalid",
michael@0 86 "Adopting should not parse style on MathML");
michael@0 87
michael@0 88 d.style.color = "green";
michael@0 89 s.style.color = "green";
michael@0 90 is (m.style, undefined, ".style shouldn't exist on MathML");
michael@0 91
michael@0 92 is(d.getAttribute("style"), "color: green;",
michael@0 93 "Adjusting .style should parse style on HTML");
michael@0 94 is(s.getAttribute("style"), "color: green;",
michael@0 95 "Adjusting .style should parse style on SVG");
michael@0 96
michael@0 97 </script>
michael@0 98 </pre>
michael@0 99 </body>
michael@0 100 </html>
michael@0 101

mercurial