2 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
3 <?xml-stylesheet href=
"chrome://mochikit/content/tests/SimpleTest/test.css" type=
"text/css"?>
5 https://bugzilla.mozilla.org/show_bug.cgi?id=445177
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">
13 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
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>
19 <xul:hbox id=
"b1" value=
"foo"/>
20 <xul:hbox id=
"o1" observes=
"b1"/>
23 <script class=
"testbody" type=
"text/javascript">
25 SimpleTest.waitForExplicitFinish();
27 var b1 = document.getElementById(
"b1");
28 var o1 = document.getElementById(
"o1");
30 is(o1.getAttribute(
"value"), b1.getAttribute(
"value"),
"Wrong value (1)");
32 b1.setAttribute(
"value",
"bar");
33 is(o1.getAttribute(
"value"), b1.getAttribute(
"value"),
"Wrong value (2)");
35 b1.removeAttribute(
"value");
36 is(o1.hasAttribute(
"value"), b1.hasAttribute(
"value"),
"Wrong value (3)");
38 o1.setAttribute(
"value",
"foo");
39 isnot(o1.getAttribute(
"value"), b1.getAttribute(
"value"),
"Wrong value (4)");
41 b1.setAttribute(
"value",
"foobar");
42 is(o1.getAttribute(
"value"), b1.getAttribute(
"value"),
"Wrong value (5)");
44 //After removing listener, changes to broadcaster shouldn't have any effect.
46 b1.setAttribute(
"value",
"foo");
47 isnot(o1.getAttribute(
"value"), b1.getAttribute(
"value"),
"Wrong value (6)");
49 b1.parentNode.appendChild(o1);
50 is(o1.getAttribute(
"value"), b1.getAttribute(
"value"),
"Wrong value (7)");
53 o1.removeAttribute(
"observes");
54 o1.removeAttribute(
"value");
55 b1.parentNode.appendChild(o1);
56 isnot(o1.getAttribute(
"value"), b1.getAttribute(
"value"),
"Wrong value (8)");
61 addLoadEvent(do_test);