test_bug445177.xhtml (2216B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> 4 <!-- 5 https://bugzilla.mozilla.org/show_bug.cgi?id=445177 6 --> 7 <window title="Test for Bug 445177" 8 id="test_bug445177.xhtml" 9 xmlns:html="http://www.w3.org/1999/xhtml" 10 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 11 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 12 13 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 14 15 <body id="body" xmlns="http://www.w3.org/1999/xhtml"> 16 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=445177">Mozilla Bug 445177</a> 17 18 19 <xul:hbox id="b1" value="foo"/> 20 <xul:hbox id="o1" observes="b1"/> 21 22 <pre id="test"> 23 <script class="testbody" type="text/javascript"> 24 <![CDATA[ 25 SimpleTest.waitForExplicitFinish(); 26 function do_test() { 27 var b1 = document.getElementById("b1"); 28 var o1 = document.getElementById("o1"); 29 30 is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (1)"); 31 32 b1.setAttribute("value", "bar"); 33 is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (2)"); 34 35 b1.removeAttribute("value"); 36 is(o1.hasAttribute("value"), b1.hasAttribute("value"), "Wrong value (3)"); 37 38 o1.setAttribute("value", "foo"); 39 isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (4)"); 40 41 b1.setAttribute("value", "foobar"); 42 is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (5)"); 43 44 //After removing listener, changes to broadcaster shouldn't have any effect. 45 o1.remove(); 46 b1.setAttribute("value", "foo"); 47 isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (6)"); 48 49 b1.parentNode.appendChild(o1); 50 is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (7)"); 51 52 o1.remove(); 53 o1.removeAttribute("observes"); 54 o1.removeAttribute("value"); 55 b1.parentNode.appendChild(o1); 56 isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (8)"); 57 58 SimpleTest.finish(); 59 } 60 61 addLoadEvent(do_test); 62 ]]> 63 </script> 64 </pre> 65 </body> 66 </window>