content/base/test/test_bug418214.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug418214.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,101 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=418214
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 418214</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=418214">Mozilla Bug 418214</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none">
    1.18 +  
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script class="testbody" type="text/javascript">
    1.22 +
    1.23 +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>';
    1.24 +
    1.25 +/** Test for Bug 418214 **/
    1.26 +var doc = (new DOMParser()).parseFromString(str, "text/xml");
    1.27 +var d = doc.getElementById("d");
    1.28 +var s = doc.getElementById("s");
    1.29 +var m = doc.getElementById("m");
    1.30 +
    1.31 +is(d.getAttribute("style"), "border:: invalid",
    1.32 +   "Shouldn't be parsing style on HTML in data documents");
    1.33 +is(s.getAttribute("style"), "border:: invalid",
    1.34 +   "Shouldn't be parsing style on SVG in data documents");
    1.35 +is(m.getAttribute("style"), "border:: invalid",
    1.36 +   "Shouldn't be parsing style on MathML in data documents");
    1.37 +
    1.38 +var d2 = d.cloneNode(true);
    1.39 +var s2 = s.cloneNode(true);
    1.40 +var m2 = m.cloneNode(true);
    1.41 +
    1.42 +is(d2.getAttribute("style"), "border:: invalid",
    1.43 +   "Shouldn't be parsing style on HTML on clone");
    1.44 +is(s2.getAttribute("style"), "border:: invalid",
    1.45 +   "Shouldn't be parsing style on SVG on clone");
    1.46 +is(m2.getAttribute("style"), "border:: invalid",
    1.47 +   "Shouldn't be parsing style on MathML on clone");
    1.48 +
    1.49 +d2.style;
    1.50 +s2.style;
    1.51 +m2.style;
    1.52 +
    1.53 +is(d2.getAttribute("style"), "border:: invalid",
    1.54 +   "Getting .style shouldn't affect style attribute on HTML");
    1.55 +is(s2.getAttribute("style"), "border:: invalid",
    1.56 +   "Getting .style shouldn't affect style attribute on SVG");
    1.57 +is(m2.getAttribute("style"), "border:: invalid",
    1.58 +   "Getting .style shouldn't affect style attribute on MathML");
    1.59 +
    1.60 +d2.style.color = "green";
    1.61 +s2.style.color = "green";
    1.62 +is (m2.style, undefined, ".style shouldn't exist on MathML");
    1.63 +
    1.64 +is(d2.getAttribute("style"), "color: green;",
    1.65 +   "Adjusting .style should parse style on HTML");
    1.66 +is(s2.getAttribute("style"), "color: green;",
    1.67 +   "Getting .style should parse style on SVG");
    1.68 +
    1.69 +d = document.adoptNode(d);
    1.70 +s = document.adoptNode(s);
    1.71 +m = document.adoptNode(m);
    1.72 +
    1.73 +is(d.getAttribute("style"), "border:: invalid",
    1.74 +   "Adopting should not parse style on HTML");
    1.75 +is(s.getAttribute("style"), "border:: invalid",
    1.76 +   "Adopting should not parse style on SVG");
    1.77 +is(m.getAttribute("style"), "border:: invalid",
    1.78 +   "Adopting should not parse style on MathML");
    1.79 +
    1.80 +$("display").appendChild(d);
    1.81 +$("display").appendChild(s);
    1.82 +$("display").appendChild(m);
    1.83 +
    1.84 +is(d.getAttribute("style"), "border:: invalid",
    1.85 +   "Adopting should not parse style on HTML");
    1.86 +is(s.getAttribute("style"), "border:: invalid",
    1.87 +   "Adopting should not parse style on SVG");
    1.88 +is(m.getAttribute("style"), "border:: invalid",
    1.89 +   "Adopting should not parse style on MathML");
    1.90 +
    1.91 +d.style.color = "green";
    1.92 +s.style.color = "green";
    1.93 +is (m.style, undefined, ".style shouldn't exist on MathML");
    1.94 +
    1.95 +is(d.getAttribute("style"), "color: green;",
    1.96 +   "Adjusting .style should parse style on HTML");
    1.97 +is(s.getAttribute("style"), "color: green;",
    1.98 +   "Adjusting .style should parse style on SVG");
    1.99 +
   1.100 +</script>
   1.101 +</pre>
   1.102 +</body>
   1.103 +</html>
   1.104 +

mercurial