| OLD | NEW |
| (Empty) |
| 1 description("Tests that accessing Attr after its Element has been destroyed work
s without crashing."); | |
| 2 | |
| 3 jsTestIsAsync = true; | |
| 4 | |
| 5 var element = document.createElement("p"); | |
| 6 element.setAttribute("a", "b"); | |
| 7 var attributes = element.attributes; | |
| 8 element = null; | |
| 9 var attr = null; | |
| 10 | |
| 11 asyncGC(function() { | |
| 12 shouldBe("attributes.length", "1"); | |
| 13 shouldBe("attributes[0]", "attributes.item(0)"); | |
| 14 shouldBe("attributes.getNamedItem('a')", "attributes.item(0)"); | |
| 15 | |
| 16 shouldBe("attributes.item(0).name", "'a'"); | |
| 17 shouldBe("attributes.item(0).value", "'b'"); | |
| 18 shouldBe("attributes.item(0).ownerElement.tagName", "'P'"); | |
| 19 | |
| 20 attributes.item(0).value = 'c'; | |
| 21 | |
| 22 shouldBe("attributes.item(0).value", "'c'"); | |
| 23 | |
| 24 attributes.removeNamedItem('a'); | |
| 25 | |
| 26 shouldBe("attributes.length", "0"); | |
| 27 | |
| 28 element = document.createElement("p"); | |
| 29 element.setAttribute("a", "b"); | |
| 30 attr = element.attributes.item(0); | |
| 31 element = null; | |
| 32 | |
| 33 asyncGC(function() { | |
| 34 | |
| 35 shouldBe("attr.name", "'a'"); | |
| 36 shouldBe("attr.value", "'b'"); | |
| 37 shouldBe("attr.ownerElement.tagName", "'P'"); | |
| 38 | |
| 39 attr.value = 'c'; | |
| 40 | |
| 41 shouldBe("attr.value", "'c'"); | |
| 42 | |
| 43 finishJSTest(); | |
| 44 }); | |
| 45 }); | |
| OLD | NEW |