3 <script src=
"../../resources/js-test.js"></script>
4 <style id=
"style" media=
"screen">
13 if (window
.testRunner
)
14 testRunner
.waitUntilDone();
16 function classString(node
)
20 var string
= Object
.prototype.toString
.apply(node
);
21 return string
.substr(8, string
.length
- 9);
24 function tagClassString(tagName
)
26 return classString(document
.createElement(tagName
));
29 function tagPrototypeClassString(tagName
)
31 return classString(document
.createElement(tagName
).__proto__
);
34 function tagConstructorClassString(tagName
)
36 return classString(document
.createElement(tagName
).constructor);
39 function tagConstructorName(tagName
)
41 return document
.createElement(tagName
).constructor.name
;
44 function testTag(tagName
, className
, prototypeName
, constructorName
)
47 prototypeName
= className
+ "Prototype";
49 constructorName
= className
;
50 shouldBeEqualToString("tagClassString('" + tagName
+ "')", className
);
51 shouldBeEqualToString("tagPrototypeClassString('" + tagName
+ "')", prototypeName
);
52 shouldBeEqualToString("tagConstructorClassString('" + tagName
+ "')", "Function");
53 shouldBeEqualToString("tagConstructorName('" + tagName
+ "')", constructorName
);
56 function test(expression
, className
, prototypeName
, constructorName
)
59 prototypeName
= className
+ "Prototype";
61 constructorName
= className
;
62 shouldBeEqualToString("classString(" + expression
+ ")", className
);
63 shouldBeEqualToString("classString(" + expression
+ ".__proto__)", prototypeName
);
64 shouldBeEqualToString("classString(" + expression
+ ".constructor)", "Function");
65 shouldBeEqualToString(expression
+ ".constructor.name", constructorName
);
70 description("This tests wrapper class names for JavaScript.");
72 stylesheet
= document
.getElementById("style").sheet
;
73 root
= document
.documentElement
;
74 xmlDocument
= document
.getElementById("xmlframe").contentDocument
;
79 test("document.createAttribute('x')", "Attr");
80 test("document.createComment('')", "Comment");
81 test("document.createDocumentFragment()", "DocumentFragment");
82 test("document.implementation", "DOMImplementation");
83 test("root.attributes", "NamedNodeMap");
84 test("document.createNodeIterator(root, 0, null, false)", "NodeIterator");
85 test("document.getElementsByTagName('div')", "HTMLCollection");
86 test("document.createRange()", "Range");
87 test("document.createTextNode('')", "Text");
88 test("document.createTreeWalker(root, 0, null, false)", "TreeWalker");
94 test("xmlDocument", "XMLDocument");
95 test("xmlDocument.createCDATASection('')", "CDATASection");
96 test("xmlDocument.createElementNS('x', 'x', 'x')", "Element");
97 test("xmlDocument.createProcessingInstruction('x', '')", "ProcessingInstruction");
103 test("document.createEvent('Event')", "Event");
104 test("document.createEvent('KeyboardEvent')", "KeyboardEvent");
105 test("document.createEvent('MouseEvent')", "MouseEvent");
106 test("document.createEvent('MutationEvent')", "MutationEvent");
107 test("document.createEvent('TextEvent')", "TextEvent");
108 test("document.createEvent('UIEvent')", "UIEvent");
109 test("document.createEvent('WheelEvent')", "WheelEvent");
115 test("document.styleSheets", "StyleSheetList");
116 test("stylesheet", "CSSStyleSheet");
117 test("stylesheet.cssRules", "CSSRuleList");
118 test("stylesheet.cssRules.item(0)", "CSSStyleRule");
119 test("stylesheet.cssRules.item(0).style", "CSSStyleDeclaration");
120 test("stylesheet.media", "MediaList");
126 test("document.createExpression('//*', document.createNSResolver(document))", "XPathExpression");
127 test("document.evaluate('//*', document, document.createNSResolver(document), 0, null)", "XPathResult");
133 test("window", "Window");
139 test("root.children", "HTMLCollection");
140 test("document", "HTMLDocument");
141 test("document.createElement('select').options", "HTMLOptionsCollection");
144 debug('HTML Elements');
147 testTag("a", "HTMLAnchorElement");
148 testTag("abbr", "HTMLElement");
149 testTag("acronym", "HTMLElement");
150 testTag("address", "HTMLElement");
151 testTag("area", "HTMLAreaElement");
152 testTag("article", "HTMLElement");
153 testTag("aside", "HTMLElement");
154 testTag("b", "HTMLElement");
155 testTag("base", "HTMLBaseElement");
156 testTag("basefont", "HTMLElement");
157 testTag("bdo", "HTMLElement");
158 testTag("bgsound", "HTMLUnknownElement");
159 testTag("big", "HTMLElement");
160 testTag("blockquote", "HTMLQuoteElement");
161 testTag("body", "HTMLBodyElement");
162 testTag("br", "HTMLBRElement");
163 testTag("button", "HTMLButtonElement");
164 testTag("canvas", "HTMLCanvasElement");
165 testTag("caption", "HTMLTableCaptionElement");
166 testTag("center", "HTMLElement");
167 testTag("cite", "HTMLElement");
168 testTag("code", "HTMLElement");
169 testTag("col", "HTMLTableColElement");
170 testTag("colgroup", "HTMLTableColElement");
171 testTag("dd", "HTMLElement");
172 testTag("del", "HTMLModElement");
173 testTag("dfn", "HTMLElement");
174 testTag("dir", "HTMLDirectoryElement");
175 testTag("div", "HTMLDivElement");
176 testTag("dl", "HTMLDListElement");
177 testTag("dt", "HTMLElement");
178 testTag("em", "HTMLElement");
179 testTag("embed", "HTMLEmbedElement");
180 testTag("fieldset", "HTMLFieldSetElement");
181 testTag("font", "HTMLFontElement");
182 testTag("footer", "HTMLElement");
183 testTag("form", "HTMLFormElement");
184 testTag("frame", "HTMLFrameElement");
185 testTag("frameset", "HTMLFrameSetElement");
186 testTag("head", "HTMLHeadElement");
187 testTag("h1", "HTMLHeadingElement");
188 testTag("h2", "HTMLHeadingElement");
189 testTag("h3", "HTMLHeadingElement");
190 testTag("h4", "HTMLHeadingElement");
191 testTag("h5", "HTMLHeadingElement");
192 testTag("h6", "HTMLHeadingElement");
193 testTag("head", "HTMLHeadElement");
194 testTag("header", "HTMLElement");
195 testTag("hgroup", "HTMLElement");
196 testTag("hr", "HTMLHRElement");
197 testTag("html", "HTMLHtmlElement");
198 testTag("i", "HTMLElement");
199 testTag("iframe", "HTMLIFrameElement");
200 testTag("image", "HTMLUnknownElement");
201 testTag("img", "HTMLImageElement");
202 testTag("input", "HTMLInputElement");
203 testTag("ins", "HTMLModElement");
204 testTag("kbd", "HTMLElement");
205 testTag("keygen", "HTMLKeygenElement");
206 testTag("label", "HTMLLabelElement");
207 testTag("layer", "HTMLElement");
208 testTag("legend", "HTMLLegendElement");
209 testTag("li", "HTMLLIElement");
210 testTag("link", "HTMLLinkElement");
211 testTag("listing", "HTMLPreElement");
212 testTag("main", "HTMLElement");
213 testTag("map", "HTMLMapElement");
214 testTag("marquee", "HTMLMarqueeElement");
215 testTag("menu", "HTMLMenuElement");
216 testTag("meta", "HTMLMetaElement");
217 testTag("nav", "HTMLElement");
218 testTag("nobr", "HTMLElement");
219 testTag("noembed", "HTMLElement");
220 testTag("noframes", "HTMLElement");
221 testTag("nolayer", "HTMLElement");
222 testTag("noscript", "HTMLElement");
223 testTag("object", "HTMLObjectElement");
224 testTag("ol", "HTMLOListElement");
225 testTag("optgroup", "HTMLOptGroupElement");
226 testTag("option", "HTMLOptionElement");
227 testTag("p", "HTMLParagraphElement");
228 testTag("param", "HTMLParamElement");
229 testTag("plaintext", "HTMLElement");
230 testTag("pre", "HTMLPreElement");
231 testTag("q", "HTMLQuoteElement");
232 testTag("rp", "HTMLElement");
233 testTag("rt", "HTMLElement");
234 testTag("ruby", "HTMLElement");
235 testTag("s", "HTMLElement");
236 testTag("samp", "HTMLElement");
237 testTag("script", "HTMLScriptElement");
238 testTag("section", "HTMLElement");
239 testTag("select", "HTMLSelectElement");
240 testTag("small", "HTMLElement");
241 testTag("span", "HTMLSpanElement");
242 testTag("strike", "HTMLElement");
243 testTag("strong", "HTMLElement");
244 testTag("style", "HTMLStyleElement");
245 testTag("sub", "HTMLElement");
246 testTag("sup", "HTMLElement");
247 testTag("table", "HTMLTableElement");
248 testTag("tbody", "HTMLTableSectionElement");
249 testTag("td", "HTMLTableCellElement");
250 testTag("textarea", "HTMLTextAreaElement");
251 testTag("tfoot", "HTMLTableSectionElement");
252 testTag("th", "HTMLTableCellElement");
253 testTag("thead", "HTMLTableSectionElement");
254 testTag("title", "HTMLTitleElement");
255 testTag("tr", "HTMLTableRowElement");
256 testTag("tt", "HTMLElement");
257 testTag("u", "HTMLElement");
258 testTag("ul", "HTMLUListElement");
259 testTag("var", "HTMLElement");
260 testTag("wbr", "HTMLElement");
261 testTag("xmp", "HTMLPreElement");
270 // WebKitCSSKeyframeRule
271 // WebKitCSSKeyframesRule
276 // Conditional elements, VIDEO, RUBY.
278 // the various window sub-objects
280 // what else is missing?
282 if (window
.testRunner
)
283 testRunner
.notifyDone();
286 function frameLoaded()
292 <iframe id=
"xmlframe" onload=
"frameLoaded()" style=
"height:0px" src=
"data:application/xhtml+xml,<?xml version='1.0' encoding='UTF-8'?><body/>"></iframe>