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