1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/events/test/test_bug391568.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,77 @@ 1.4 +<?xml version="1.0"?> 1.5 +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xbl="http://www.mozilla.org/xbl"> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=391568 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 391568</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 + <script> 1.14 + var constructorFired = 0; 1.15 + </script> 1.16 + <xbl:bindings> 1.17 + <xbl:binding id="test"> 1.18 + <xbl:content><span> 1.19 + (anonumous content) 1.20 + <span><xbl:children/></span> 1.21 + (anonumous content)</span> 1.22 + </xbl:content> 1.23 + 1.24 + <xbl:implementation> 1.25 + <xbl:constructor> 1.26 + var win = XPCNativeWrapper.unwrap(window); 1.27 + ++win.constructorFired; 1.28 + document.getAnonymousNodes(this)[0].addEventListener( 1.29 + "DOMCharacterDataModified", 1.30 + function(evt) { 1.31 + ++win.characterdatamodified; 1.32 + }, 1.33 + true); 1.34 + </xbl:constructor> 1.35 + </xbl:implementation> 1.36 + </xbl:binding> 1.37 + </xbl:bindings> 1.38 +</head> 1.39 +<body> 1.40 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391568">Mozilla Bug 391568</a> 1.41 +<p id="display"></p> 1.42 +<div id="content"> 1.43 + <span style="-moz-binding: url(#test);"><span id="real1">(real content)</span></span> 1.44 + <span style="-moz-binding: url(#test);"><span id="real2">(real content)</span></span> 1.45 +</div> 1.46 +<pre id="test"> 1.47 +<script class="testbody" type="text/javascript"> 1.48 +<![CDATA[ 1.49 + 1.50 +/** Test for Bug 391568 **/ 1.51 + 1.52 +var characterdatamodified = 0; 1.53 + 1.54 +document.getElementById('real1').addEventListener( 1.55 + "DOMCharacterDataModified", 1.56 + function(evt) {}, 1.57 + true); 1.58 + 1.59 +function testListeners() { 1.60 + if (constructorFired < 2) { 1.61 + setTimeout(testListeners, 0); 1.62 + return; 1.63 + } 1.64 + document.getElementById('real1').firstChild.data = "(real content 2)"; 1.65 + ok(characterdatamodified == 1, 1.66 + "There is a DOMCharacterDataModified listener in anonymous content which didn't get called (1)!"); 1.67 + document.getElementById('real2').firstChild.data = "(real content 2)"; 1.68 + ok(characterdatamodified == 2, 1.69 + "There is a DOMCharacterDataModified listener in anonymous content which didn't get called (2)!"); 1.70 + SimpleTest.finish(); 1.71 +} 1.72 + 1.73 +SimpleTest.waitForExplicitFinish(); 1.74 +addLoadEvent(testListeners); 1.75 +]]> 1.76 +</script> 1.77 +</pre> 1.78 +</body> 1.79 +</html> 1.80 +