ProcessingInstruction.DOMCharacterDataModified.xml (2118B)
1 <?xml version="1.0"?> 2 <root> 3 <head xmlns="http://www.w3.org/1999/xhtml"> 4 <title> ProcessingInstruction.data and DOMCharacterDataModified event </title> 5 </head> 6 7 <p xmlns="http://www.w3.org/1999/xhtml"> 8 <h3>DOM Events</h3> 9 <h4> 10 Test Description: DOMCharacterDataModified event fires after ProcessingInstruction.data have been modified, 11 but the node itself has not been inserted or deleted. The proximal event target of this event shall be the 12 ProcessingInstruction node. 13 </h4> 14 15 <pi><?foo bar?></pi> 16 17 <p>Test passes if the word "PASS" appears below.</p> 18 <div>Test result: </div> 19 <div><testresult>FAIL</testresult></div> 20 21 <script type="text/javascript" xmlns="http://www.w3.org/1999/xhtml"> 22 <![CDATA[ 23 var PassTest = function() 24 { 25 document.getElementsByTagName("testresult")[0].firstChild.data = "PASS"; 26 TestResult = true; 27 } 28 29 var FailTest = function() 30 { 31 document.getElementsByTagName("testresult")[0].firstChild.data = "FAIL"; 32 TestResult = false; 33 } 34 35 var EVENT = "DOMCharacterDataModified"; 36 var TARGET = document.getElementsByTagName('pi')[0].firstChild; 37 var TestResult = false; 38 39 try 40 { 41 TARGET.addEventListener(EVENT, TestEvent, false); 42 TARGET.data = "new" + TARGET.data; 43 } 44 catch(ex) 45 { 46 FailTest(); 47 } 48 49 function TestEvent(evt) 50 { 51 if ((EVENT == evt.type) && (TARGET == evt.target) && ("newbar" == evt.newValue)) 52 { 53 PassTest(); 54 } 55 else 56 { 57 FailTest(); 58 } 59 } 60 ]]> 61 </script> 62 </p> 63 </root>