| OLD | NEW |
| 1 description("Test creation of each type of Node and check intial values") | 1 description("Test creation of each type of Node and check intial values") |
| 2 | 2 |
| 3 var xmlDoc = document.implementation.createDocument("http://www.w3.org/1999/xhtm
l", "html", null); | 3 var xmlDoc = document.implementation.createDocument("http://www.w3.org/1999/xhtm
l", "html", null); |
| 4 | 4 |
| 5 debug("Attribute creation using createElement on an HTML doc:") | 5 debug("Attribute creation using createElement on an HTML doc:") |
| 6 var attr = document.createAttribute("foo"); | 6 var attr = document.createAttribute("foo"); |
| 7 shouldBe("attr.nodeName", "'foo'"); | 7 shouldBe("attr.nodeName", "'foo'"); |
| 8 shouldBe("attr.name", "'foo'"); | 8 shouldBe("attr.name", "'foo'"); |
| 9 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create
Attribute | 9 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create
Attribute |
| 10 // Both FF and WebKit return "foo" for Attribute.localName, even though the spec
says null | 10 // Both FF and WebKit return "foo" for Attribute.localName, even though the spec
says null |
| 11 shouldBe("attr.localName", "null"); | 11 shouldBe("attr.localName", "null"); |
| 12 shouldBe("attr.namespaceURI", "null"); | 12 shouldBe("attr.namespaceURI", "null"); |
| 13 shouldBe("attr.prefix", "null"); | 13 shouldBe("attr.prefix", "null"); |
| 14 shouldBe("attr.value", "''"); | 14 shouldBe("attr.value", "''"); |
| 15 | 15 |
| 16 debug("Attribute creation using createElementNS on an HTML doc:") |
| 17 attr = document.createAttributeNS("http://www.example.com", "example:foo"); |
| 18 shouldBe("attr.nodeName", "'example:foo'"); |
| 19 shouldBe("attr.name", "'example:foo'"); |
| 20 shouldBe("attr.localName", "'foo'"); |
| 21 shouldBe("attr.namespaceURI", "'http://www.example.com'"); |
| 22 shouldBe("attr.prefix", "'example'"); |
| 23 shouldBe("attr.nodeValue", "''"); |
| 24 shouldBe("attr.value", "''"); |
| 25 |
| 16 debug("Attribute creation using createElement on an XHTML doc:") | 26 debug("Attribute creation using createElement on an XHTML doc:") |
| 17 attr = xmlDoc.createAttribute("foo"); | 27 attr = xmlDoc.createAttribute("foo"); |
| 18 shouldBe("attr.nodeName", "'foo'"); | 28 shouldBe("attr.nodeName", "'foo'"); |
| 19 shouldBe("attr.name", "'foo'"); | 29 shouldBe("attr.name", "'foo'"); |
| 20 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create
Attribute | 30 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create
Attribute |
| 21 // Both FF and WebKit return "foo" for Attribute.localName, even though the spec
says null | 31 // Both FF and WebKit return "foo" for Attribute.localName, even though the spec
says null |
| 22 shouldBe("attr.localName", "null"); | 32 shouldBe("attr.localName", "null"); |
| 23 shouldBe("attr.namespaceURI", "null"); | 33 shouldBe("attr.namespaceURI", "null"); |
| 24 shouldBe("attr.prefix", "null"); | 34 shouldBe("attr.prefix", "null"); |
| 25 shouldBe("attr.value", "''"); | 35 shouldBe("attr.value", "''"); |
| 26 | 36 |
| 37 debug("Attribute creation using createElementNS on an XHTML doc:") |
| 38 attr = xmlDoc.createAttributeNS("http://www.example.com", "example:foo"); |
| 39 shouldBe("attr.nodeName", "'example:foo'"); |
| 40 shouldBe("attr.name", "'example:foo'"); |
| 41 shouldBe("attr.localName", "'foo'"); |
| 42 shouldBe("attr.namespaceURI", "'http://www.example.com'"); |
| 43 shouldBe("attr.prefix", "'example'"); |
| 44 shouldBe("attr.nodeValue", "''"); |
| 45 shouldBe("attr.value", "''"); |
| 46 |
| 27 var comment = document.createComment("foo"); | 47 var comment = document.createComment("foo"); |
| 28 shouldBe("comment.nodeName", "'#comment'"); | 48 shouldBe("comment.nodeName", "'#comment'"); |
| 29 shouldBe("comment.localName", "null"); | 49 shouldBe("comment.localName", "null"); |
| 30 shouldBe("comment.namespaceURI", "null"); | 50 shouldBe("comment.namespaceURI", "null"); |
| 31 shouldBe("comment.nodeValue", "'foo'"); | 51 shouldBe("comment.nodeValue", "'foo'"); |
| 32 shouldBe("comment.data", "'foo'"); | 52 shouldBe("comment.data", "'foo'"); |
| 33 | 53 |
| 34 shouldThrow("document.createCDATASection('foo')"); | 54 shouldThrow("document.createCDATASection('foo')"); |
| 35 var cdata = xmlDoc.createCDATASection("foo"); | 55 var cdata = xmlDoc.createCDATASection("foo"); |
| 36 shouldBe("cdata.nodeName", "'#cdata-section'"); | 56 shouldBe("cdata.nodeName", "'#cdata-section'"); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 shouldBe("processingInstruction.target", "'xml-stylesheet'"); | 171 shouldBe("processingInstruction.target", "'xml-stylesheet'"); |
| 152 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); | 172 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); |
| 153 | 173 |
| 154 debug("Text node creation using createTextNode on an HTML doc:") | 174 debug("Text node creation using createTextNode on an HTML doc:") |
| 155 var text = document.createTextNode("foo"); | 175 var text = document.createTextNode("foo"); |
| 156 shouldBe("text.nodeName", "'#text'"); | 176 shouldBe("text.nodeName", "'#text'"); |
| 157 shouldBe("text.localName", "null"); | 177 shouldBe("text.localName", "null"); |
| 158 shouldBe("text.namespaceURI", "null"); | 178 shouldBe("text.namespaceURI", "null"); |
| 159 shouldBe("text.nodeValue", "'foo'"); | 179 shouldBe("text.nodeValue", "'foo'"); |
| 160 shouldBe("text.data", "'foo'"); | 180 shouldBe("text.data", "'foo'"); |
| OLD | NEW |