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 | |
160 | |
161 shouldThrow("document.createProcessingInstruction('xml-stylesheet', 'type=\"text /xsl\" href=\"missing.xsl\"')"); | |
jochen (gone - plz use gerrit)
2013/12/05 11:12:09
so the following few lines should also pass if you
philipj_slow
2013/12/05 11:57:26
Done.
| |
162 var processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="missing.xsl"'); | 159 var processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="missing.xsl"'); |
163 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); | 160 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); |
164 shouldBe("processingInstruction.localName", "null"); | 161 shouldBe("processingInstruction.localName", "null"); |
165 shouldBe("processingInstruction.namespaceURI", "null"); | 162 shouldBe("processingInstruction.namespaceURI", "null"); |
166 shouldBe("processingInstruction.prefix", "null"); | 163 shouldBe("processingInstruction.prefix", "null"); |
167 // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeV alue | 164 // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeV alue |
168 // L2: entire content excluding the target | 165 // L2: entire content excluding the target |
169 // L3: same as ProcessingInstruction.data | 166 // L3: same as ProcessingInstruction.data |
170 // We're following Level 3 | 167 // We're following Level 3 |
171 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x sl\"'"); | 168 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x sl\"'"); |
172 shouldBe("processingInstruction.target", "'xml-stylesheet'"); | 169 shouldBe("processingInstruction.target", "'xml-stylesheet'"); |
173 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"' "); | 170 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"' "); |
174 | 171 |
175 var text = document.createTextNode("foo"); | 172 var text = document.createTextNode("foo"); |
176 shouldBe("text.nodeName", "'#text'"); | 173 shouldBe("text.nodeName", "'#text'"); |
177 shouldBe("text.localName", "null"); | 174 shouldBe("text.localName", "null"); |
178 shouldBe("text.namespaceURI", "null"); | 175 shouldBe("text.namespaceURI", "null"); |
179 shouldBe("text.prefix", "null"); | 176 shouldBe("text.prefix", "null"); |
180 shouldBe("text.nodeValue", "'foo'"); | 177 shouldBe("text.nodeValue", "'foo'"); |
181 shouldBe("text.data", "'foo'"); | 178 shouldBe("text.data", "'foo'"); |
OLD | NEW |