| <?xml version="1.0"?> |
| <root> |
| <head xmlns="http://www.w3.org/1999/xhtml"> |
| <title> ProcessingInstruction.data and DOMCharacterDataModified event </title> |
| </head> |
| |
| <p xmlns="http://www.w3.org/1999/xhtml"> |
| <h3>DOM Events</h3> |
| <h4> |
| Test Description: DOMCharacterDataModified event fires after ProcessingInstruction.data have been modified, |
| but the node itself has not been inserted or deleted. The proximal event target of this event shall be the |
| ProcessingInstruction node. |
| </h4> |
| |
| <pi><?foo bar?></pi> |
| |
| <p>Test passes if the word "PASS" appears below.</p> |
| <div>Test result: </div> |
| <div><testresult>FAIL</testresult></div> |
| |
| <script type="text/javascript" xmlns="http://www.w3.org/1999/xhtml"> |
| <![CDATA[ |
| var PassTest = function() |
| { |
| document.getElementsByTagName("testresult")[0].firstChild.data = "PASS"; |
| TestResult = true; |
| } |
| |
| var FailTest = function() |
| { |
| document.getElementsByTagName("testresult")[0].firstChild.data = "FAIL"; |
| TestResult = false; |
| } |
| |
| var EVENT = "DOMCharacterDataModified"; |
| var TARGET = document.getElementsByTagName('pi')[0].firstChild; |
| var TestResult = false; |
| |
| try |
| { |
| TARGET.addEventListener(EVENT, TestEvent, false); |
| TARGET.data = "new" + TARGET.data; |
| } |
| catch(ex) |
| { |
| FailTest(); |
| } |
| |
| function TestEvent(evt) |
| { |
| if ((EVENT == evt.type) && (TARGET == evt.target) && ("newbar" == evt.newValue)) |
| { |
| PassTest(); |
| } |
| else |
| { |
| FailTest(); |
| } |
| } |
| ]]> |
| </script> |
| </p> |
| </root> |