OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../js/resources/js-test-pre.js"></script> | 4 <script src="../js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <div id="newParent"></div> | 7 <div id="newParent"></div> |
8 <a href="#" id="target"></a> | 8 <a href="#" id="target"></a> |
9 <script> | 9 <script> |
10 description("Test that adoptNode fails safely if prevented by a DOM mutation."); | 10 description("Test that adoptNode fails safely if prevented by a DOM mutation."); |
11 | 11 |
12 function run() { | 12 function run() { |
13 newParent = document.getElementById("newParent"); | 13 newParent = document.getElementById("newParent"); |
14 target = document.getElementById("target"); | 14 target = document.getElementById("target"); |
15 target.addEventListener("blur", function () { newParent.appendChild(target);
}, false); | 15 target.addEventListener("blur", function () { newParent.appendChild(target);
}, false); |
16 target.focus(); | 16 target.focus(); |
17 var anotherDocument = document.implementation.createDocument("", "", null); | 17 var anotherDocument = document.implementation.createDocument("", "", null); |
18 | 18 |
19 try { anotherDocument.adoptNode(target); } catch(e) {} | 19 try { anotherDocument.adoptNode(target); } catch(e) {} |
20 shouldBe("target.ownerDocument.location", "document.location"); | 20 shouldBe("target.ownerDocument.location", "document.location"); |
21 } | 21 } |
22 | 22 |
23 document.addEventListener("DOMContentLoaded", run, false); | 23 document.addEventListener("DOMContentLoaded", run, false); |
24 </script> | 24 </script> |
25 <script src="../js/resources/js-test-post.js"></script> | 25 <script src="../js/resources/js-test-post.js"></script> |
26 </body> | 26 </body> |
27 </html> | 27 </html> |
OLD | NEW |