| 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 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 debug("Element creation using createElementNS on an XHTML doc:") | 150 debug("Element creation using createElementNS on an XHTML doc:") |
| 151 element = xmlDoc.createElementNS("http://www.w3.org/1999/xhtml", "html:pre"); | 151 element = xmlDoc.createElementNS("http://www.w3.org/1999/xhtml", "html:pre"); |
| 152 shouldBe("element.nodeName", "'html:pre'"); | 152 shouldBe("element.nodeName", "'html:pre'"); |
| 153 shouldBe("element.localName", "'pre'"); | 153 shouldBe("element.localName", "'pre'"); |
| 154 shouldBe("element.namespaceURI", "'http://www.w3.org/1999/xhtml'"); | 154 shouldBe("element.namespaceURI", "'http://www.w3.org/1999/xhtml'"); |
| 155 shouldBe("element.prefix", "'html'"); | 155 shouldBe("element.prefix", "'html'"); |
| 156 shouldBe("element.nodeValue", "null"); | 156 shouldBe("element.nodeValue", "null"); |
| 157 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'"); | 157 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'"); |
| 158 | 158 |
| 159 // Not possible to create Notation nodes via the DOM, WebKit doesn't create them
from parsing | 159 debug("Processing instruction creation using createProcessingInstruction on an H
TML doc:") |
| 160 | 160 var processingInstruction = document.createProcessingInstruction('xml-stylesheet
', 'type="text/xsl" href="missing.xsl"'); |
| 161 shouldThrow("document.createProcessingInstruction('xml-stylesheet', 'type=\"text
/xsl\" href=\"missing.xsl\"')"); | |
| 162 var processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet',
'type="text/xsl" href="missing.xsl"'); | |
| 163 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); | 161 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); |
| 164 shouldBe("processingInstruction.localName", "null"); | 162 shouldBe("processingInstruction.localName", "null"); |
| 165 shouldBe("processingInstruction.namespaceURI", "null"); | 163 shouldBe("processingInstruction.namespaceURI", "null"); |
| 166 shouldBe("processingInstruction.prefix", "null"); | 164 shouldBe("processingInstruction.prefix", "null"); |
| 167 // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeV
alue | 165 // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeV
alue |
| 168 // L2: entire content excluding the target | 166 // L2: entire content excluding the target |
| 169 // L3: same as ProcessingInstruction.data | 167 // L3: same as ProcessingInstruction.data |
| 170 // We're following Level 3 | 168 // We're following Level 3 |
| 171 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x
sl\"'"); | 169 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x
sl\"'"); |
| 172 shouldBe("processingInstruction.target", "'xml-stylesheet'"); | 170 shouldBe("processingInstruction.target", "'xml-stylesheet'"); |
| 173 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); | 171 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); |
| 174 | 172 |
| 173 debug("Processing instruction creation using createProcessingInstruction on an X
HTML doc:") |
| 174 processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet', 'ty
pe="text/xsl" href="missing.xsl"'); |
| 175 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); |
| 176 shouldBe("processingInstruction.localName", "null"); |
| 177 shouldBe("processingInstruction.namespaceURI", "null"); |
| 178 shouldBe("processingInstruction.prefix", "null"); |
| 179 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x
sl\"'"); |
| 180 shouldBe("processingInstruction.target", "'xml-stylesheet'"); |
| 181 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); |
| 182 |
| 183 debug("Text node creation using createTextNode on an HTML doc:") |
| 175 var text = document.createTextNode("foo"); | 184 var text = document.createTextNode("foo"); |
| 176 shouldBe("text.nodeName", "'#text'"); | 185 shouldBe("text.nodeName", "'#text'"); |
| 177 shouldBe("text.localName", "null"); | 186 shouldBe("text.localName", "null"); |
| 178 shouldBe("text.namespaceURI", "null"); | 187 shouldBe("text.namespaceURI", "null"); |
| 179 shouldBe("text.prefix", "null"); | 188 shouldBe("text.prefix", "null"); |
| 180 shouldBe("text.nodeValue", "'foo'"); | 189 shouldBe("text.nodeValue", "'foo'"); |
| 181 shouldBe("text.data", "'foo'"); | 190 shouldBe("text.data", "'foo'"); |
| OLD | NEW |