content/base/test/test_bug418214.html

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

mercurial