Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=744830 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 8 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 9 | </head> |
michael@0 | 10 | <body> |
michael@0 | 11 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a> |
michael@0 | 12 | <div id="testnodes"><span>hi</span> there <!-- mon ami --></div> |
michael@0 | 13 | <pre id="test"> |
michael@0 | 14 | <script type="application/javascript"> |
michael@0 | 15 | var t = document.getElementById('testnodes'); |
michael@0 | 16 | is(t.innerHTML, |
michael@0 | 17 | "<span>hi</span> there <!-- mon ami -->", |
michael@0 | 18 | "comment nodes should be included"); |
michael@0 | 19 | |
michael@0 | 20 | var PI = document.createProcessingInstruction('foo', 'bar="1.0"'); |
michael@0 | 21 | t.appendChild(PI); |
michael@0 | 22 | is(t.innerHTML, '<span>hi</span> there <!-- mon ami --><?foo bar="1.0">', |
michael@0 | 23 | "pi nodes should be included"); |
michael@0 | 24 | |
michael@0 | 25 | t.innerHTML = null; |
michael@0 | 26 | t.appendChild(document.createElement("textarea")); |
michael@0 | 27 | t.firstChild.appendChild(document.createTextNode("\nhello")); |
michael@0 | 28 | // This is the old behavior. Spec requires something else. |
michael@0 | 29 | is(t.innerHTML, "<textarea>\nhello</textarea>", |
michael@0 | 30 | "No extra newlines should be inserted to the textarea!"); |
michael@0 | 31 | |
michael@0 | 32 | t.innerHTML = null; |
michael@0 | 33 | t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg:svg")); |
michael@0 | 34 | t.firstChild.textContent = "<foo>"; |
michael@0 | 35 | is(t.innerHTML, "<svg><foo></svg>"); |
michael@0 | 36 | |
michael@0 | 37 | t.innerHTML = null; |
michael@0 | 38 | t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math:math")); |
michael@0 | 39 | t.firstChild.textContent = "<foo>"; |
michael@0 | 40 | is(t.innerHTML, "<math><foo></math>"); |
michael@0 | 41 | |
michael@0 | 42 | // Prefix is serialized if element isn't HTML/SVG/MathML |
michael@0 | 43 | t.innerHTML = null; |
michael@0 | 44 | t.appendChild(document.createElementNS("http://www.example.org", "ex:example")); |
michael@0 | 45 | t.firstChild.textContent = "<foo>"; |
michael@0 | 46 | is(t.innerHTML, "<ex:example><foo></ex:example>"); |
michael@0 | 47 | |
michael@0 | 48 | t.innerHTML = null; |
michael@0 | 49 | t.appendChild(document.createElementNS("http://www.example.org", "example")); |
michael@0 | 50 | t.firstChild.textContent = "<foo>"; |
michael@0 | 51 | is(t.innerHTML, "<example><foo></example>"); |
michael@0 | 52 | |
michael@0 | 53 | t.firstChild.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:lang", "us-en"); |
michael@0 | 54 | is(t.innerHTML, '<example xml:lang="us-en"><foo></example>'); |
michael@0 | 55 | |
michael@0 | 56 | t.firstChild.setAttributeNS("http://www.w3.org/1999/xlink", "href", "foo"); |
michael@0 | 57 | is(t.innerHTML, '<example xlink:href="foo" xml:lang="us-en"><foo></example>'); |
michael@0 | 58 | |
michael@0 | 59 | t.firstChild.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", "http://foo"); |
michael@0 | 60 | is(t.innerHTML, '<example xmlns="http://foo" xlink:href="foo" xml:lang="us-en"><foo></example>'); |
michael@0 | 61 | |
michael@0 | 62 | t.firstChild.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:bar", "http://bar"); |
michael@0 | 63 | is(t.innerHTML, '<example xmlns:bar="http://bar" xmlns="http://foo" xlink:href="foo" xml:lang="us-en"><foo></example>'); |
michael@0 | 64 | |
michael@0 | 65 | t.firstChild.setAttributeNS("http://www.helloworldns.org", "hello:world", "!"); |
michael@0 | 66 | is(t.innerHTML, '<example hello:world="!" xmlns:bar="http://bar" xmlns="http://foo" xlink:href="foo" xml:lang="us-en"><foo></example>'); |
michael@0 | 67 | |
michael@0 | 68 | t.firstChild.setAttribute("foo", '-"&\xA0-'); |
michael@0 | 69 | is(t.innerHTML, '<example foo="-"& -" hello:world="!" xmlns:bar="http://bar" xmlns="http://foo" xlink:href="foo" xml:lang="us-en"><foo></example>'); |
michael@0 | 70 | |
michael@0 | 71 | t.innerHTML = null; |
michael@0 | 72 | t.appendChild(document.createElement("div")); |
michael@0 | 73 | t.firstChild.appendChild(document.implementation |
michael@0 | 74 | .createDocument(null, null, null) |
michael@0 | 75 | .createCDATASection("foo")); |
michael@0 | 76 | is(t.innerHTML, '<div>foo</div>'); |
michael@0 | 77 | |
michael@0 | 78 | t.firstChild.textContent = "1&2<3>4\xA0"; |
michael@0 | 79 | is(t.innerHTML, '<div>1&2<3>4 </div>'); |
michael@0 | 80 | |
michael@0 | 81 | t.innerHTML = null; |
michael@0 | 82 | t.appendChild(document.createElement("script")); |
michael@0 | 83 | t.firstChild.textContent = "1&2<3>4\xA0"; |
michael@0 | 84 | is(t.innerHTML, '<script>1&2<3>4\xA0\u003C/script>'); |
michael@0 | 85 | |
michael@0 | 86 | t.innerHTML = null; |
michael@0 | 87 | t.appendChild(document.createElement("style")); |
michael@0 | 88 | t.firstChild.textContent = "1&2<3>4\xA0"; |
michael@0 | 89 | is(t.innerHTML, '<style>1&2<3>4\xA0\u003C/style>'); |
michael@0 | 90 | |
michael@0 | 91 | t.innerHTML = null; |
michael@0 | 92 | t.appendChild(document.createElement("span")); |
michael@0 | 93 | t.firstChild.setAttributeNS("ext", "attr", "foo"); |
michael@0 | 94 | t.firstChild.textContent = "1&2<3>4\xA0"; |
michael@0 | 95 | is(t.innerHTML, '<span attr="foo">1&2<3>4 \u003C/span>'); |
michael@0 | 96 | |
michael@0 | 97 | t.innerHTML = null; |
michael@0 | 98 | t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg")); |
michael@0 | 99 | is(t.firstChild.namespaceURI, "http://www.w3.org/2000/svg"); |
michael@0 | 100 | t.firstChild.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "script")); |
michael@0 | 101 | is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/2000/svg"); |
michael@0 | 102 | t.firstChild.firstChild.textContent = "1&2<3>4\xA0"; |
michael@0 | 103 | is(t.innerHTML, '<svg><script>1&2<3>4 \u003C/script></svg>'); |
michael@0 | 104 | |
michael@0 | 105 | t.innerHTML = null; |
michael@0 | 106 | t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg")); |
michael@0 | 107 | is(t.firstChild.namespaceURI, "http://www.w3.org/2000/svg"); |
michael@0 | 108 | t.firstChild.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "style")); |
michael@0 | 109 | is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/2000/svg"); |
michael@0 | 110 | t.firstChild.firstChild.textContent = "1&2<3>4\xA0"; |
michael@0 | 111 | is(t.innerHTML, '<svg><style>1&2<3>4 \u003C/style></svg>'); |
michael@0 | 112 | |
michael@0 | 113 | t.innerHTML = null; |
michael@0 | 114 | t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math")); |
michael@0 | 115 | is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML"); |
michael@0 | 116 | t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "script")); |
michael@0 | 117 | is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML"); |
michael@0 | 118 | t.firstChild.firstChild.textContent = "1&2<3>4\xA0"; |
michael@0 | 119 | is(t.innerHTML, '<math><script>1&2<3>4 \u003C/script></math>'); |
michael@0 | 120 | |
michael@0 | 121 | t.innerHTML = null; |
michael@0 | 122 | t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math")); |
michael@0 | 123 | is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML"); |
michael@0 | 124 | t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "style")); |
michael@0 | 125 | is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML"); |
michael@0 | 126 | t.firstChild.firstChild.textContent = "1&2<3>4\xA0"; |
michael@0 | 127 | is(t.innerHTML, '<math><style>1&2<3>4 \u003C/style></math>'); |
michael@0 | 128 | </script> |
michael@0 | 129 | </pre> |
michael@0 | 130 | </body> |
michael@0 | 131 | </html> |
michael@0 | 132 |