Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <html xmlns="http://www.w3.org/1999/xhtml" |
michael@0 | 3 | xmlns:foobar="http://www.foobar.com"> |
michael@0 | 4 | <!-- |
michael@0 | 5 | https://bugzilla.mozilla.org/show_bug.cgi?id=362391 |
michael@0 | 6 | --> |
michael@0 | 7 | <head> |
michael@0 | 8 | <title>Test for Bug 362391</title> |
michael@0 | 9 | <!-- XHTML needs explicit script elements --> |
michael@0 | 10 | <script type="text/javascript" src="/MochiKit/Base.js"></script> |
michael@0 | 11 | <script type="text/javascript" src="/MochiKit/Iter.js"></script> |
michael@0 | 12 | <script type="text/javascript" src="/MochiKit/DOM.js"></script> |
michael@0 | 13 | <script type="text/javascript" src="/MochiKit/Style.js"></script> |
michael@0 | 14 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 15 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 16 | </head> |
michael@0 | 17 | <body> |
michael@0 | 18 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=362391">Mozilla Bug 362391</a> |
michael@0 | 19 | <p id="display"></p> |
michael@0 | 20 | <div id="content" style="display: none"> |
michael@0 | 21 | |
michael@0 | 22 | </div> |
michael@0 | 23 | <div id="test1"/> |
michael@0 | 24 | <div id="test2"/> |
michael@0 | 25 | <div id="test3" attr="null"/> |
michael@0 | 26 | <div id="test4" foobar:attr="http://www.foobar.com"/> |
michael@0 | 27 | <pre id="test"> |
michael@0 | 28 | <script class="testbody" type="text/javascript"> |
michael@0 | 29 | |
michael@0 | 30 | /** Test for Bug 362391 **/ |
michael@0 | 31 | |
michael@0 | 32 | var currentTest = 0; |
michael@0 | 33 | var expected = ""; |
michael@0 | 34 | function listener(evt) { |
michael@0 | 35 | var r = document.getElementById("result"); |
michael@0 | 36 | ++currentTest; |
michael@0 | 37 | ok(((evt.relatedNode.namespaceURI + "") == expected), |
michael@0 | 38 | evt.relatedNode.namespaceURI + " == "+ expected); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | document.addEventListener("DOMAttrModified", listener, true); |
michael@0 | 42 | |
michael@0 | 43 | function test() { |
michael@0 | 44 | expected = "null"; |
michael@0 | 45 | document.getElementById("test1") |
michael@0 | 46 | .setAttribute("attr", "null"); |
michael@0 | 47 | |
michael@0 | 48 | expected = "http://www.foobar.com"; |
michael@0 | 49 | document.getElementById("test2") |
michael@0 | 50 | .setAttributeNS("http://www.foobar.com", "attr", "http://www.foobar.com"); |
michael@0 | 51 | |
michael@0 | 52 | expected = "http://www.foobar.com"; |
michael@0 | 53 | document.getElementById("test3") |
michael@0 | 54 | .setAttributeNS("http://www.foobar.com", "attr", "http://www.foobar.com"); |
michael@0 | 55 | |
michael@0 | 56 | expected = "null"; |
michael@0 | 57 | document.getElementById("test4") |
michael@0 | 58 | .setAttribute("attr", "null"); |
michael@0 | 59 | |
michael@0 | 60 | expected = "http://www.foobar.com"; |
michael@0 | 61 | document.getElementById("test3") |
michael@0 | 62 | .removeAttributeNS("http://www.foobar.com", "attr"); |
michael@0 | 63 | |
michael@0 | 64 | expected = "null"; |
michael@0 | 65 | document.getElementById("test4") |
michael@0 | 66 | .removeAttribute("attr"); |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | test(); |
michael@0 | 70 | </script> |
michael@0 | 71 | </pre> |
michael@0 | 72 | |
michael@0 | 73 | </body> |
michael@0 | 74 | </html> |
michael@0 | 75 |