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