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 Entity nodes via the DOM, WebKit doesn't create them f
rom parsing | |
160 | |
161 shouldThrow("document.createEntityReference('gt')"); | |
162 var entityReference = xmlDoc.createEntityReference("gt"); | |
163 shouldBe("entityReference.nodeName", "'gt'"); | |
164 shouldBe("entityReference.localName", "null"); | |
165 shouldBe("entityReference.namespaceURI", "null"); | |
166 shouldBe("entityReference.prefix", "null"); | |
167 shouldBe("entityReference.nodeValue", "null"); | |
168 | |
169 // Not possible to create Notation nodes via the DOM, WebKit doesn't create them
from parsing | 159 // Not possible to create Notation nodes via the DOM, WebKit doesn't create them
from parsing |
170 | 160 |
171 shouldThrow("document.createProcessingInstruction('xml-stylesheet', 'type=\"text
/xsl\" href=\"missing.xsl\"')"); | 161 shouldThrow("document.createProcessingInstruction('xml-stylesheet', 'type=\"text
/xsl\" href=\"missing.xsl\"')"); |
172 var processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet',
'type="text/xsl" href="missing.xsl"'); | 162 var processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet',
'type="text/xsl" href="missing.xsl"'); |
173 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); | 163 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); |
174 shouldBe("processingInstruction.localName", "null"); | 164 shouldBe("processingInstruction.localName", "null"); |
175 shouldBe("processingInstruction.namespaceURI", "null"); | 165 shouldBe("processingInstruction.namespaceURI", "null"); |
176 shouldBe("processingInstruction.prefix", "null"); | 166 shouldBe("processingInstruction.prefix", "null"); |
177 // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeV
alue | 167 // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeV
alue |
178 // L2: entire content excluding the target | 168 // L2: entire content excluding the target |
179 // L3: same as ProcessingInstruction.data | 169 // L3: same as ProcessingInstruction.data |
180 // We're following Level 3 | 170 // We're following Level 3 |
181 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x
sl\"'"); | 171 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x
sl\"'"); |
182 shouldBe("processingInstruction.target", "'xml-stylesheet'"); | 172 shouldBe("processingInstruction.target", "'xml-stylesheet'"); |
183 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); | 173 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); |
184 | 174 |
185 var text = document.createTextNode("foo"); | 175 var text = document.createTextNode("foo"); |
186 shouldBe("text.nodeName", "'#text'"); | 176 shouldBe("text.nodeName", "'#text'"); |
187 shouldBe("text.localName", "null"); | 177 shouldBe("text.localName", "null"); |
188 shouldBe("text.namespaceURI", "null"); | 178 shouldBe("text.namespaceURI", "null"); |
189 shouldBe("text.prefix", "null"); | 179 shouldBe("text.prefix", "null"); |
190 shouldBe("text.nodeValue", "'foo'"); | 180 shouldBe("text.nodeValue", "'foo'"); |
191 shouldBe("text.data", "'foo'"); | 181 shouldBe("text.data", "'foo'"); |
OLD | NEW |