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()", "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('OverflowEvent')", "OverflowEvent");
108 test("document.createEvent('TextEvent')", "TextEvent");
109 test("document.createEvent('UIEvent')", "UIEvent");
110 test("document.createEvent('WheelEvent')", "WheelEvent");
116 test("document.styleSheets", "StyleSheetList");
117 test("stylesheet", "CSSStyleSheet");
118 test("stylesheet.cssRules", "CSSRuleList");
119 test("stylesheet.cssRules.item(0)", "CSSStyleRule");
120 test("stylesheet.cssRules.item(0).style", "CSSStyleDeclaration");
121 test("stylesheet.media", "MediaList");
127 test("document.createExpression('//*', document.createNSResolver(document))", "XPathExpression");
128 test("document.evaluate('//*', document, document.createNSResolver(document), 0, null)", "XPathResult");
134 test("window", "Window");
140 test("root.children", "HTMLCollection");
141 test("document", "HTMLDocument");
142 test("document.createElement('select').options", "HTMLOptionsCollection");
145 debug('HTML Elements');
148 testTag("a", "HTMLAnchorElement");
149 testTag("abbr", "HTMLElement");
150 testTag("acronym", "HTMLElement");
151 testTag("address", "HTMLElement");
152 testTag("applet", "HTMLAppletElement");
153 testTag("area", "HTMLAreaElement");
154 testTag("article", "HTMLElement");
155 testTag("aside", "HTMLElement");
156 testTag("b", "HTMLElement");
157 testTag("base", "HTMLBaseElement");
158 testTag("basefont", "HTMLElement");
159 testTag("bdo", "HTMLElement");
160 testTag("big", "HTMLElement");
161 testTag("blockquote", "HTMLQuoteElement");
162 testTag("body", "HTMLBodyElement");
163 testTag("br", "HTMLBRElement");
164 testTag("button", "HTMLButtonElement");
165 testTag("canvas", "HTMLCanvasElement");
166 testTag("caption", "HTMLTableCaptionElement");
167 testTag("center", "HTMLElement");
168 testTag("cite", "HTMLElement");
169 testTag("code", "HTMLElement");
170 testTag("col", "HTMLTableColElement");
171 testTag("colgroup", "HTMLTableColElement");
172 testTag("dd", "HTMLElement");
173 testTag("del", "HTMLModElement");
174 testTag("dfn", "HTMLElement");
175 testTag("dir", "HTMLDirectoryElement");
176 testTag("div", "HTMLDivElement");
177 testTag("dl", "HTMLDListElement");
178 testTag("dt", "HTMLElement");
179 testTag("em", "HTMLElement");
180 testTag("embed", "HTMLEmbedElement");
181 testTag("fieldset", "HTMLFieldSetElement");
182 testTag("font", "HTMLFontElement");
183 testTag("footer", "HTMLElement");
184 testTag("form", "HTMLFormElement");
185 testTag("frame", "HTMLFrameElement");
186 testTag("frameset", "HTMLFrameSetElement");
187 testTag("head", "HTMLHeadElement");
188 testTag("h1", "HTMLHeadingElement");
189 testTag("h2", "HTMLHeadingElement");
190 testTag("h3", "HTMLHeadingElement");
191 testTag("h4", "HTMLHeadingElement");
192 testTag("h5", "HTMLHeadingElement");
193 testTag("h6", "HTMLHeadingElement");
194 testTag("head", "HTMLHeadElement");
195 testTag("header", "HTMLElement");
196 testTag("hgroup", "HTMLElement");
197 testTag("hr", "HTMLHRElement");
198 testTag("html", "HTMLHtmlElement");
199 testTag("i", "HTMLElement");
200 testTag("iframe", "HTMLIFrameElement");
201 testTag("image", "HTMLUnknownElement");
202 testTag("img", "HTMLImageElement");
203 testTag("input", "HTMLInputElement");
204 testTag("ins", "HTMLModElement");
205 testTag("kbd", "HTMLElement");
206 testTag("keygen", "HTMLKeygenElement");
207 testTag("label", "HTMLLabelElement");
208 testTag("layer", "HTMLElement");
209 testTag("legend", "HTMLLegendElement");
210 testTag("li", "HTMLLIElement");
211 testTag("link", "HTMLLinkElement");
212 testTag("listing", "HTMLPreElement");
213 testTag("main", "HTMLElement");
214 testTag("map", "HTMLMapElement");
215 testTag("marquee", "HTMLMarqueeElement");
216 testTag("menu", "HTMLMenuElement");
217 testTag("meta", "HTMLMetaElement");
218 testTag("nav", "HTMLElement");
219 testTag("nobr", "HTMLElement");
220 testTag("noembed", "HTMLElement");
221 testTag("noframes", "HTMLElement");
222 testTag("nolayer", "HTMLElement");
223 testTag("noscript", "HTMLElement");
224 testTag("object", "HTMLObjectElement");
225 testTag("ol", "HTMLOListElement");
226 testTag("optgroup", "HTMLOptGroupElement");
227 testTag("option", "HTMLOptionElement");
228 testTag("p", "HTMLParagraphElement");
229 testTag("param", "HTMLParamElement");
230 testTag("plaintext", "HTMLElement");
231 testTag("pre", "HTMLPreElement");
232 testTag("q", "HTMLQuoteElement");
233 testTag("rp", "HTMLElement");
234 testTag("rt", "HTMLElement");
235 testTag("ruby", "HTMLElement");
236 testTag("s", "HTMLElement");
237 testTag("samp", "HTMLElement");
238 testTag("script", "HTMLScriptElement");
239 testTag("section", "HTMLElement");
240 testTag("select", "HTMLSelectElement");
241 testTag("small", "HTMLElement");
242 testTag("span", "HTMLSpanElement");
243 testTag("strike", "HTMLElement");
244 testTag("strong", "HTMLElement");
245 testTag("style", "HTMLStyleElement");
246 testTag("sub", "HTMLElement");
247 testTag("sup", "HTMLElement");
248 testTag("table", "HTMLTableElement");
249 testTag("tbody", "HTMLTableSectionElement");
250 testTag("td", "HTMLTableCellElement");
251 testTag("textarea", "HTMLTextAreaElement");
252 testTag("tfoot", "HTMLTableSectionElement");
253 testTag("th", "HTMLTableCellElement");
254 testTag("thead", "HTMLTableSectionElement");
255 testTag("title", "HTMLTitleElement");
256 testTag("tr", "HTMLTableRowElement");
257 testTag("tt", "HTMLElement");
258 testTag("u", "HTMLElement");
259 testTag("ul", "HTMLUListElement");
260 testTag("var", "HTMLElement");
261 testTag("wbr", "HTMLElement");
262 testTag("xmp", "HTMLPreElement");
272 // WebKitCSSKeyframeRule
273 // WebKitCSSKeyframesRule
278 // Conditional elements, VIDEO, RUBY.
280 // the various window sub-objects
282 // what else is missing?
284 if (window.testRunner)
285 testRunner.notifyDone();
288 function frameLoaded()
294 <iframe id="xmlframe" onload="frameLoaded()" style="height:0px" src="data:application/xhtml+xml,<?xml version='1.0' encoding='UTF-8'?><body/>"></iframe>