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