Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / dom / wrapper-classes.html
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <style id="style" media="screen">
5 .non-existent-class {
6     color: rgb(0, 0, 0);
7 }
8 </style>
9 </head>
10 <body>
11 <script>
12
13 if (window.testRunner)
14     testRunner.waitUntilDone();
15
16 function classString(node)
17 {
18     if (!node)
19         return "[null]";
20     var string = Object.prototype.toString.apply(node);
21     return string.substr(8, string.length - 9);
22 }
23
24 function tagClassString(tagName)
25 {
26     return classString(document.createElement(tagName));
27 }
28
29 function tagPrototypeClassString(tagName)
30 {
31     return classString(document.createElement(tagName).__proto__);
32 }
33
34 function tagConstructorClassString(tagName)
35 {
36     return classString(document.createElement(tagName).constructor);
37 }
38
39 function tagConstructorName(tagName)
40 {
41     return document.createElement(tagName).constructor.name;
42 }
43
44 function testTag(tagName, className, prototypeName, constructorName)
45 {
46     if (!prototypeName)
47         prototypeName = className + "Prototype";
48     if (!constructorName)
49         constructorName = className;
50     shouldBeEqualToString("tagClassString('" + tagName + "')", className);
51     shouldBeEqualToString("tagPrototypeClassString('" + tagName + "')", prototypeName);
52     shouldBeEqualToString("tagConstructorClassString('" + tagName + "')", "Function");
53     shouldBeEqualToString("tagConstructorName('" + tagName + "')", constructorName);
54 }
55
56 function test(expression, className, prototypeName, constructorName)
57 {
58     if (!prototypeName)
59         prototypeName = className + "Prototype";
60     if (!constructorName)
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);
66 }
67
68 function runTest()
69 {
70     description("This tests wrapper class names for JavaScript.");
71
72     stylesheet = document.getElementById("style").sheet;
73     root = document.documentElement;
74     xmlDocument = document.getElementById("xmlframe").contentDocument;
75
76     debug('Basics');
77     debug('');
78
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");
89
90     debug('');
91     debug('XML');
92     debug('');
93
94     test("xmlDocument", "XMLDocument");
95     test("xmlDocument.createCDATASection()", "CDATASection");
96     test("xmlDocument.createElementNS('x', 'x', 'x')", "Element");
97     test("xmlDocument.createProcessingInstruction('x', '')", "ProcessingInstruction");
98
99     debug('');
100     debug('Events');
101     debug('');
102
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");
111
112     debug('');
113     debug('CSS DOM');
114     debug('');
115
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");
122
123     debug('');
124     debug('XPath');
125     debug('');
126
127     test("document.createExpression('//*', document.createNSResolver(document))", "XPathExpression");
128     test("document.evaluate('//*', document, document.createNSResolver(document), 0, null)", "XPathResult");
129
130     debug('');
131     debug('Other');
132     debug('');
133
134     test("window", "Window");
135
136     debug('');
137     debug('HTML DOM');
138     debug('');
139
140     test("root.children", "HTMLCollection");
141     test("document", "HTMLDocument");
142     test("document.createElement('select').options", "HTMLOptionsCollection");
143
144     debug('');
145     debug('HTML Elements');
146     debug('');
147
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");
263
264     // Not yet tested:
265
266     // CSSCharsetRule
267     // CSSFontFaceRule
268     // CSSImportRule
269     // CSSMediaRule
270     // CSSPageRule
271     // CSSRule
272     // WebKitCSSKeyframeRule
273     // WebKitCSSKeyframesRule
274     // SVGColor
275     // SVGPaint
276     // SVGZoomEvent
277
278     // Conditional elements, VIDEO, RUBY.
279
280     // the various window sub-objects
281
282     // what else is missing?
283
284     if (window.testRunner)
285         testRunner.notifyDone();
286 }
287
288 function frameLoaded()
289 {
290     runTest();
291 }
292
293 </script>
294 <iframe id="xmlframe" onload="frameLoaded()" style="height:0px" src="data:application/xhtml+xml,<?xml version='1.0' encoding='UTF-8'?><body/>"></iframe>
295 </body>
296 </html>