dom/events/test/test_bug391568.xhtml

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:d8d4626bbda2
1 <?xml version="1.0"?>
2 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xbl="http://www.mozilla.org/xbl">
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=391568
5 -->
6 <head>
7 <title>Test for Bug 391568</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 <script>
11 var constructorFired = 0;
12 </script>
13 <xbl:bindings>
14 <xbl:binding id="test">
15 <xbl:content><span>
16 (anonumous content)
17 <span><xbl:children/></span>
18 (anonumous content)</span>
19 </xbl:content>
20
21 <xbl:implementation>
22 <xbl:constructor>
23 var win = XPCNativeWrapper.unwrap(window);
24 ++win.constructorFired;
25 document.getAnonymousNodes(this)[0].addEventListener(
26 "DOMCharacterDataModified",
27 function(evt) {
28 ++win.characterdatamodified;
29 },
30 true);
31 </xbl:constructor>
32 </xbl:implementation>
33 </xbl:binding>
34 </xbl:bindings>
35 </head>
36 <body>
37 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391568">Mozilla Bug 391568</a>
38 <p id="display"></p>
39 <div id="content">
40 <span style="-moz-binding: url(#test);"><span id="real1">(real content)</span></span>
41 <span style="-moz-binding: url(#test);"><span id="real2">(real content)</span></span>
42 </div>
43 <pre id="test">
44 <script class="testbody" type="text/javascript">
45 <![CDATA[
46
47 /** Test for Bug 391568 **/
48
49 var characterdatamodified = 0;
50
51 document.getElementById('real1').addEventListener(
52 "DOMCharacterDataModified",
53 function(evt) {},
54 true);
55
56 function testListeners() {
57 if (constructorFired < 2) {
58 setTimeout(testListeners, 0);
59 return;
60 }
61 document.getElementById('real1').firstChild.data = "(real content 2)";
62 ok(characterdatamodified == 1,
63 "There is a DOMCharacterDataModified listener in anonymous content which didn't get called (1)!");
64 document.getElementById('real2').firstChild.data = "(real content 2)";
65 ok(characterdatamodified == 2,
66 "There is a DOMCharacterDataModified listener in anonymous content which didn't get called (2)!");
67 SimpleTest.finish();
68 }
69
70 SimpleTest.waitForExplicitFinish();
71 addLoadEvent(testListeners);
72 ]]>
73 </script>
74 </pre>
75 </body>
76 </html>
77

mercurial