| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script src="script-tests/access-after-element-destruction.js"></script> | 7 <script> |
| 8 description("Tests that accessing Attr after its Element has been destroyed work
s without crashing."); |
| 9 |
| 10 jsTestIsAsync = true; |
| 11 |
| 12 var element = document.createElement("p"); |
| 13 element.setAttribute("a", "b"); |
| 14 var attributes = element.attributes; |
| 15 element = null; |
| 16 var attr = null; |
| 17 |
| 18 asyncGC(function() { |
| 19 shouldBe("attributes.length", "1"); |
| 20 shouldBe("attributes[0]", "attributes.item(0)"); |
| 21 shouldBe("attributes.getNamedItem('a')", "attributes.item(0)"); |
| 22 |
| 23 shouldBe("attributes.item(0).name", "'a'"); |
| 24 shouldBe("attributes.item(0).value", "'b'"); |
| 25 shouldBe("attributes.item(0).ownerElement.tagName", "'P'"); |
| 26 |
| 27 attributes.item(0).value = 'c'; |
| 28 |
| 29 shouldBe("attributes.item(0).value", "'c'"); |
| 30 |
| 31 attributes.removeNamedItem('a'); |
| 32 |
| 33 shouldBe("attributes.length", "0"); |
| 34 |
| 35 element = document.createElement("p"); |
| 36 element.setAttribute("a", "b"); |
| 37 attr = element.attributes.item(0); |
| 38 element = null; |
| 39 |
| 40 asyncGC(function() { |
| 41 |
| 42 shouldBe("attr.name", "'a'"); |
| 43 shouldBe("attr.value", "'b'"); |
| 44 shouldBe("attr.ownerElement.tagName", "'P'"); |
| 45 |
| 46 attr.value = 'c'; |
| 47 |
| 48 shouldBe("attr.value", "'c'"); |
| 49 |
| 50 finishJSTest(); |
| 51 }); |
| 52 }); |
| 53 </script> |
| 8 </body> | 54 </body> |
| 9 </html> | 55 </html> |
| OLD | NEW |