| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../../../resources/js-test-pre.js"></script> |
| <script> |
| description("Test the Element.getAttributeNames() API"); |
| |
| var element = document.createElement("div"); |
| shouldBe("element.getAttributeNames().length", "0"); |
| |
| element.setAttribute("foo", "bar"); |
| shouldBe("element.getAttributeNames().length", "1"); |
| shouldBe("element.getAttributeNames()[0]", "element.attributes[0].name"); |
| shouldBeEqualToString("element.getAttributeNames()[0]", "foo"); |
| |
| element.removeAttribute("foo"); |
| shouldBe("element.getAttributeNames().length", "0"); |
| |
| element.setAttribute("foo", "bar"); |
| element.setAttributeNS("", "FOO", "bar"); |
| element.setAttributeNS("dummy1", "foo", "bar"); |
| element.setAttributeNS("dummy2", "dummy:foo", "bar"); |
| shouldBe("element.getAttributeNames().length", "4"); |
| shouldBeEqualToString("element.getAttributeNames()[0]", "foo"); |
| shouldBeEqualToString("element.getAttributeNames()[1]", "FOO"); |
| shouldBeEqualToString("element.getAttributeNames()[2]", "foo"); |
| shouldBeEqualToString("element.getAttributeNames()[3]", "dummy:foo"); |
| shouldBe("element.getAttributeNames()[0]", "element.attributes[0].name"); |
| shouldBe("element.getAttributeNames()[1]", "element.attributes[1].name"); |
| shouldBe("element.getAttributeNames()[2]", "element.attributes[2].name"); |
| shouldBe("element.getAttributeNames()[3]", "element.attributes[3].name"); |
| |
| element.removeAttributeNS("", "FOO"); |
| shouldBe("element.getAttributeNames().length", "3"); |
| shouldBeEqualToString("element.getAttributeNames()[0]", "foo"); |
| shouldBeEqualToString("element.getAttributeNames()[1]", "foo"); |
| shouldBeEqualToString("element.getAttributeNames()[2]", "dummy:foo"); |
| shouldBe("element.getAttributeNames()[0]", "element.attributes[0].name"); |
| shouldBe("element.getAttributeNames()[1]", "element.attributes[1].name"); |
| shouldBe("element.getAttributeNames()[2]", "element.attributes[2].name"); |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |