OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <p>Test of createContextualFragment from a Range whose context is a text node be
longing to an element. If the test succeeds you will see the word "PASS" below.<
/p> |
| 3 <p id="result"></p> |
| 4 <script> |
| 5 if (window.testRunner) |
| 6 testRunner.dumpAsText(); |
| 7 |
| 8 var textNode = document.createTextNode("Text node that belongs to an element"); |
| 9 var textNodeParent = document.createElement('p'); |
| 10 textNodeParent.appendChild(textNode); |
| 11 |
| 12 var range = document.createRange(); |
| 13 range.setStart(textNode, 0); |
| 14 var fragment = range.createContextualFragment('<p id="fragment">Inserted fragmen
t</p>'); |
| 15 document.body.appendChild(fragment); |
| 16 var p = document.getElementById('fragment'); |
| 17 |
| 18 var result = document.getElementById('result'); |
| 19 result.textContent = (p && p.parentElement === document.body && p.namespaceURI =
== 'http://www.w3.org/1999/xhtml') ? 'PASS' : 'FAIL'; |
| 20 </script> |
OLD | NEW |