| 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 28 matching lines...) Expand all Loading... |
| 39 shouldBe("attr.nodeName", "'example:foo'"); | 39 shouldBe("attr.nodeName", "'example:foo'"); |
| 40 shouldBe("attr.name", "'example:foo'"); | 40 shouldBe("attr.name", "'example:foo'"); |
| 41 shouldBe("attr.localName", "'foo'"); | 41 shouldBe("attr.localName", "'foo'"); |
| 42 shouldBe("attr.namespaceURI", "'http://www.example.com'"); | 42 shouldBe("attr.namespaceURI", "'http://www.example.com'"); |
| 43 shouldBe("attr.prefix", "'example'"); | 43 shouldBe("attr.prefix", "'example'"); |
| 44 shouldBe("attr.nodeValue", "''"); | 44 shouldBe("attr.nodeValue", "''"); |
| 45 shouldBe("attr.value", "''"); | 45 shouldBe("attr.value", "''"); |
| 46 | 46 |
| 47 var comment = document.createComment("foo"); | 47 var comment = document.createComment("foo"); |
| 48 shouldBe("comment.nodeName", "'#comment'"); | 48 shouldBe("comment.nodeName", "'#comment'"); |
| 49 shouldBe("comment.localName", "null"); | 49 shouldBe("comment.localName", "undefined"); |
| 50 shouldBe("comment.namespaceURI", "null"); | 50 shouldBe("comment.namespaceURI", "undefined"); |
| 51 shouldBe("comment.nodeValue", "'foo'"); | 51 shouldBe("comment.nodeValue", "'foo'"); |
| 52 shouldBe("comment.data", "'foo'"); | 52 shouldBe("comment.data", "'foo'"); |
| 53 | 53 |
| 54 shouldThrow("document.createCDATASection('foo')"); | 54 shouldThrow("document.createCDATASection('foo')"); |
| 55 var cdata = xmlDoc.createCDATASection("foo"); | 55 var cdata = xmlDoc.createCDATASection("foo"); |
| 56 shouldBe("cdata.nodeName", "'#cdata-section'"); | 56 shouldBe("cdata.nodeName", "'#cdata-section'"); |
| 57 shouldBe("cdata.localName", "null"); | 57 shouldBe("cdata.localName", "undefined"); |
| 58 shouldBe("cdata.namespaceURI", "null"); | 58 shouldBe("cdata.namespaceURI", "undefined"); |
| 59 shouldBe("cdata.nodeValue", "'foo'"); | 59 shouldBe("cdata.nodeValue", "'foo'"); |
| 60 shouldBe("cdata.data", "'foo'"); | 60 shouldBe("cdata.data", "'foo'"); |
| 61 | 61 |
| 62 var fragment = document.createDocumentFragment(); | 62 var fragment = document.createDocumentFragment(); |
| 63 shouldBe("fragment.nodeName", "'#document-fragment'"); | 63 shouldBe("fragment.nodeName", "'#document-fragment'"); |
| 64 shouldBe("fragment.localName", "null"); | 64 shouldBe("fragment.localName", "undefined"); |
| 65 shouldBe("fragment.namespaceURI", "null"); | 65 shouldBe("fragment.namespaceURI", "undefined"); |
| 66 shouldBe("fragment.nodeValue", "null"); | 66 shouldBe("fragment.nodeValue", "null"); |
| 67 | 67 |
| 68 var doc = document.implementation.createDocument("http://www.w3.org/1999/xhtml",
"html", null); | 68 var doc = document.implementation.createDocument("http://www.w3.org/1999/xhtml",
"html", null); |
| 69 shouldBe("doc.nodeName", "'#document'"); | 69 shouldBe("doc.nodeName", "'#document'"); |
| 70 shouldBe("doc.localName", "null"); | 70 shouldBe("doc.localName", "undefined"); |
| 71 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create
Document | 71 shouldBe("doc.namespaceURI", "undefined"); |
| 72 // Currently both FF and WebKit return null here, disagreeing with the spec | |
| 73 shouldBe("doc.namespaceURI", "'http://www.w3.org/1999/xhtml'"); | |
| 74 shouldBe("doc.nodeValue", "null"); | 72 shouldBe("doc.nodeValue", "null"); |
| 75 | 73 |
| 76 var doctype = document.implementation.createDocumentType("svg", "-//W3C//DTD SVG
1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"); | 74 var doctype = document.implementation.createDocumentType("svg", "-//W3C//DTD SVG
1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"); |
| 77 shouldBe("doctype.nodeName", "'svg'"); | 75 shouldBe("doctype.nodeName", "'svg'"); |
| 78 shouldBe("doctype.name", "'svg'"); | 76 shouldBe("doctype.name", "'svg'"); |
| 79 shouldBe("doctype.localName", "null"); | 77 shouldBe("doctype.localName", "undefined"); |
| 80 shouldBe("doctype.namespaceURI", "null"); | 78 shouldBe("doctype.namespaceURI", "undefined"); |
| 81 shouldBe("doctype.nodeValue", "null"); | 79 shouldBe("doctype.nodeValue", "null"); |
| 82 | 80 |
| 83 debug("Element creation using createElement on an HTML doc:") | 81 debug("Element creation using createElement on an HTML doc:") |
| 84 var element = document.createElement("pre"); | 82 var element = document.createElement("pre"); |
| 85 shouldBe("element.nodeName", "'PRE'"); | 83 shouldBe("element.nodeName", "'PRE'"); |
| 86 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create
Element | 84 // Spec: http://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-create
Element |
| 87 // FF returns "PRE" for localName, WebKit returns "pre", the spec says we should
return null | 85 // FF returns "PRE" for localName, WebKit returns "pre", the spec says we should
return null |
| 88 shouldBe("element.localName", "null"); | 86 shouldBe("element.localName", "null"); |
| 89 // FF returns null for namespaceURI, WebKit returns http://www.w3.org/1999/xhtml
, the spec says we should return null | 87 // FF returns null for namespaceURI, WebKit returns http://www.w3.org/1999/xhtml
, the spec says we should return null |
| 90 shouldBe("element.namespaceURI", "null"); | 88 shouldBe("element.namespaceURI", "null"); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 shouldBe("element.nodeName", "'html:pre'"); | 143 shouldBe("element.nodeName", "'html:pre'"); |
| 146 shouldBe("element.localName", "'pre'"); | 144 shouldBe("element.localName", "'pre'"); |
| 147 shouldBe("element.namespaceURI", "'http://www.w3.org/1999/xhtml'"); | 145 shouldBe("element.namespaceURI", "'http://www.w3.org/1999/xhtml'"); |
| 148 shouldBe("element.prefix", "'html'"); | 146 shouldBe("element.prefix", "'html'"); |
| 149 shouldBe("element.nodeValue", "null"); | 147 shouldBe("element.nodeValue", "null"); |
| 150 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'"); | 148 shouldBe("element.attributes.toString()", "'[object NamedNodeMap]'"); |
| 151 | 149 |
| 152 debug("Processing instruction creation using createProcessingInstruction on an H
TML doc:") | 150 debug("Processing instruction creation using createProcessingInstruction on an H
TML doc:") |
| 153 var processingInstruction = document.createProcessingInstruction('xml-stylesheet
', 'type="text/xsl" href="missing.xsl"'); | 151 var processingInstruction = document.createProcessingInstruction('xml-stylesheet
', 'type="text/xsl" href="missing.xsl"'); |
| 154 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); | 152 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); |
| 155 shouldBe("processingInstruction.localName", "null"); | 153 shouldBe("processingInstruction.localName", "undefined"); |
| 156 shouldBe("processingInstruction.namespaceURI", "null"); | 154 shouldBe("processingInstruction.namespaceURI", "undefined"); |
| 157 // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeV
alue | 155 // DOM Core Level 2 and DOM Core Level 3 disagree on ProcessingInstruction.nodeV
alue |
| 158 // L2: entire content excluding the target | 156 // L2: entire content excluding the target |
| 159 // L3: same as ProcessingInstruction.data | 157 // L3: same as ProcessingInstruction.data |
| 160 // We're following Level 3 | 158 // We're following Level 3 |
| 161 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x
sl\"'"); | 159 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x
sl\"'"); |
| 162 shouldBe("processingInstruction.target", "'xml-stylesheet'"); | 160 shouldBe("processingInstruction.target", "'xml-stylesheet'"); |
| 163 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); | 161 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); |
| 164 | 162 |
| 165 debug("Processing instruction creation using createProcessingInstruction on an X
HTML doc:") | 163 debug("Processing instruction creation using createProcessingInstruction on an X
HTML doc:") |
| 166 processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet', 'ty
pe="text/xsl" href="missing.xsl"'); | 164 processingInstruction = xmlDoc.createProcessingInstruction('xml-stylesheet', 'ty
pe="text/xsl" href="missing.xsl"'); |
| 167 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); | 165 shouldBe("processingInstruction.nodeName", "'xml-stylesheet'"); |
| 168 shouldBe("processingInstruction.localName", "null"); | 166 shouldBe("processingInstruction.localName", "undefined"); |
| 169 shouldBe("processingInstruction.namespaceURI", "null"); | 167 shouldBe("processingInstruction.namespaceURI", "undefined"); |
| 170 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x
sl\"'"); | 168 shouldBe("processingInstruction.nodeValue", "'type=\"text/xsl\" href=\"missing.x
sl\"'"); |
| 171 shouldBe("processingInstruction.target", "'xml-stylesheet'"); | 169 shouldBe("processingInstruction.target", "'xml-stylesheet'"); |
| 172 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); | 170 shouldBe("processingInstruction.data", "'type=\"text/xsl\" href=\"missing.xsl\"'
"); |
| 173 | 171 |
| 174 debug("Text node creation using createTextNode on an HTML doc:") | 172 debug("Text node creation using createTextNode on an HTML doc:") |
| 175 var text = document.createTextNode("foo"); | 173 var text = document.createTextNode("foo"); |
| 176 shouldBe("text.nodeName", "'#text'"); | 174 shouldBe("text.nodeName", "'#text'"); |
| 177 shouldBe("text.localName", "null"); | 175 shouldBe("text.localName", "undefined"); |
| 178 shouldBe("text.namespaceURI", "null"); | 176 shouldBe("text.namespaceURI", "undefined"); |
| 179 shouldBe("text.nodeValue", "'foo'"); | 177 shouldBe("text.nodeValue", "'foo'"); |
| 180 shouldBe("text.data", "'foo'"); | 178 shouldBe("text.data", "'foo'"); |
| OLD | NEW |