dom/events/test/test_bug391568.xhtml

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

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

mercurial