blob: 3555091a03ba0842e350137291d7d343921c3547 [file] [log] [blame]
<html><!-- webkit-test-runner [ KeygenElementEnabled=true ] -->
<head>
<script src="../../resources/js-test-pre.js"></script>
<style id="style" media="screen">
.non-existent-class {
color: rgb(0, 0, 0);
clip: rect(0, 0, 1, 1);
content: counter(dummy, square);
}
</style>
</head>
<body>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
function jsWrapperClass(node)
{
if (!node)
return "[null]";
var string = Object.prototype.toString.apply(node);
return string.substr(8, string.length - 9);
}
function tagJSWrapperClass(tagName)
{
return jsWrapperClass(document.createElement(tagName));
}
function tagJSWrapperPrototypeClass(tagName)
{
return jsWrapperClass(document.createElement(tagName).__proto__);
}
function tagJSWrapperConstructorClass(tagName)
{
return jsWrapperClass(document.createElement(tagName).constructor);
}
function testTag(tagName, className)
{
shouldBe("tagJSWrapperClass('" + tagName + "')", "'" + className + "'");
shouldBe("tagJSWrapperPrototypeClass('" + tagName + "')", "'" + className + "'");
shouldBe("tagJSWrapperConstructorClass('" + tagName + "')", "'Function'");
}
function test(expression, className)
{
shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'");
shouldBe("jsWrapperClass(" + expression + ".__proto__)", "'" + className + "'");
shouldBe("jsWrapperClass(" + expression + ".constructor)", "'Function'");
}
function runTest()
{
// NOTE: This is a sister test to platform/mac/fast/dom/wrapper-class-objc.html which test the Objective-C wrapper classes. Update accordingly.
description("This tests wrapper class names for JavaScript.");
stylesheet = document.getElementById("style").sheet;
root = document.documentElement;
xmlDocument = document.getElementById("xmlframe").contentDocument;
debug('Basics');
debug('');
test("document.createAttribute('test')", "Attr");
test("document.createComment('test')", "Comment");
test("document.createDocumentFragment()", "DocumentFragment");
test("document.implementation", "DOMImplementation");
test("root.attributes", "NamedNodeMap");
test("document.createNodeIterator(root, 0, null, false)", "NodeIterator");
test("document.getElementsByTagName('div')", "HTMLCollection");
test("document.createRange()", "Range");
test("document.createTextNode('test')", "Text");
test("document.createTreeWalker(root, 0, null, false)", "TreeWalker");
debug('');
debug('XML');
debug('');
test("xmlDocument", "XMLDocument");
test("xmlDocument.createCDATASection('test')", "CDATASection");
test("xmlDocument.createElementNS('x', 'x', 'x')", "Element");
test("xmlDocument.createProcessingInstruction('target', 'test')", "ProcessingInstruction");
debug('');
debug('Events');
debug('');
test("document.createEvent('Event')", "Event");
test("document.createEvent('KeyboardEvent')", "KeyboardEvent");
test("document.createEvent('MouseEvent')", "MouseEvent");
test("document.createEvent('MutationEvent')", "MutationEvent");
test("document.createEvent('OverflowEvent')", "OverflowEvent");
test("document.createEvent('TextEvent')", "TextEvent");
test("document.createEvent('UIEvent')", "UIEvent");
test("document.createEvent('WheelEvent')", "WheelEvent");
debug('');
debug('CSS DOM');
debug('');
test("document.styleSheets", "StyleSheetList");
test("stylesheet", "CSSStyleSheet");
test("stylesheet.cssRules", "CSSRuleList");
test("stylesheet.cssRules.item(0)", "CSSStyleRule");
test("stylesheet.cssRules.item(0).style", "CSSStyleDeclaration");
test("stylesheet.cssRules.item(0).style.getPropertyCSSValue('color')", "CSSPrimitiveValue");
test("stylesheet.cssRules.item(0).style.getPropertyCSSValue('color').getRGBColorValue()", "RGBColor");
test("stylesheet.cssRules.item(0).style.getPropertyCSSValue('clip').getRectValue()", "Rect");
test("stylesheet.cssRules.item(0).style.getPropertyCSSValue('content')", "CSSValueList");
test("stylesheet.cssRules.item(0).style.getPropertyCSSValue('content').item(0).getCounterValue()", "Counter");
test("stylesheet.media", "MediaList");
debug('');
debug('XPath');
debug('');
test("document.createExpression('//*', document.createNSResolver(document))", "XPathExpression");
test("document.evaluate('//*', document, document.createNSResolver(document), 0, null)", "XPathResult");
debug('');
debug('Other');
debug('');
test("window", "Window");
debug('');
debug('HTML DOM');
debug('');
test("root.children", "HTMLCollection");
test("document", "HTMLDocument");
test("document.createElement('select').options", "HTMLOptionsCollection");
debug('');
debug('HTML Elements');
debug('');
testTag("a", "HTMLAnchorElement");
testTag("abbr", "HTMLElement");
testTag("acronym", "HTMLElement");
testTag("address", "HTMLElement");
testTag("area", "HTMLAreaElement");
testTag("article", "HTMLElement");
testTag("aside", "HTMLElement");
testTag("b", "HTMLElement");
testTag("base", "HTMLBaseElement");
testTag("bdo", "HTMLElement");
testTag("big", "HTMLElement");
testTag("blockquote", "HTMLQuoteElement");
testTag("body", "HTMLBodyElement");
testTag("br", "HTMLBRElement");
testTag("button", "HTMLButtonElement");
testTag("canvas", "HTMLCanvasElement");
testTag("caption", "HTMLTableCaptionElement");
testTag("center", "HTMLElement");
testTag("cite", "HTMLElement");
testTag("code", "HTMLElement");
testTag("col", "HTMLTableColElement");
testTag("colgroup", "HTMLTableColElement");
testTag("dd", "HTMLElement");
testTag("del", "HTMLModElement");
testTag("dfn", "HTMLElement");
testTag("dir", "HTMLDirectoryElement");
testTag("div", "HTMLDivElement");
testTag("dl", "HTMLDListElement");
testTag("dt", "HTMLElement");
testTag("em", "HTMLElement");
testTag("embed", "HTMLEmbedElement");
testTag("fieldset", "HTMLFieldSetElement");
testTag("font", "HTMLFontElement");
testTag("footer", "HTMLElement");
testTag("form", "HTMLFormElement");
testTag("frame", "HTMLFrameElement");
testTag("frameset", "HTMLFrameSetElement");
testTag("head", "HTMLHeadElement");
testTag("h1", "HTMLHeadingElement");
testTag("h2", "HTMLHeadingElement");
testTag("h3", "HTMLHeadingElement");
testTag("h4", "HTMLHeadingElement");
testTag("h5", "HTMLHeadingElement");
testTag("h6", "HTMLHeadingElement");
testTag("head", "HTMLHeadElement");
testTag("header", "HTMLElement");
testTag("hgroup", "HTMLElement");
testTag("hr", "HTMLHRElement");
testTag("html", "HTMLHtmlElement");
testTag("i", "HTMLElement");
testTag("iframe", "HTMLIFrameElement");
testTag("image", "HTMLUnknownElement");
testTag("img", "HTMLImageElement");
testTag("input", "HTMLInputElement");
testTag("ins", "HTMLModElement");
testTag("kbd", "HTMLElement");
testTag("keygen", "HTMLKeygenElement");
testTag("label", "HTMLLabelElement");
testTag("layer", "HTMLElement");
testTag("legend", "HTMLLegendElement");
testTag("li", "HTMLLIElement");
testTag("link", "HTMLLinkElement");
testTag("listing", "HTMLPreElement");
testTag("main", "HTMLElement");
testTag("map", "HTMLMapElement");
testTag("marquee", "HTMLMarqueeElement");
testTag("menu", "HTMLMenuElement");
testTag("meta", "HTMLMetaElement");
testTag("nav", "HTMLElement");
testTag("nobr", "HTMLElement");
testTag("noembed", "HTMLElement");
testTag("noframes", "HTMLElement");
testTag("nolayer", "HTMLElement");
testTag("noscript", "HTMLElement");
testTag("object", "HTMLObjectElement");
testTag("ol", "HTMLOListElement");
testTag("optgroup", "HTMLOptGroupElement");
testTag("option", "HTMLOptionElement");
testTag("p", "HTMLParagraphElement");
testTag("param", "HTMLParamElement");
testTag("plaintext", "HTMLElement");
testTag("pre", "HTMLPreElement");
testTag("q", "HTMLQuoteElement");
testTag("rp", "HTMLElement");
testTag("rt", "HTMLElement");
testTag("ruby", "HTMLElement");
testTag("s", "HTMLElement");
testTag("samp", "HTMLElement");
testTag("script", "HTMLScriptElement");
testTag("section", "HTMLElement");
testTag("select", "HTMLSelectElement");
testTag("small", "HTMLElement");
testTag("span", "HTMLSpanElement");
testTag("strike", "HTMLElement");
testTag("strong", "HTMLElement");
testTag("style", "HTMLStyleElement");
testTag("sub", "HTMLElement");
testTag("sup", "HTMLElement");
testTag("table", "HTMLTableElement");
testTag("tbody", "HTMLTableSectionElement");
testTag("td", "HTMLTableCellElement");
testTag("textarea", "HTMLTextAreaElement");
testTag("tfoot", "HTMLTableSectionElement");
testTag("th", "HTMLTableCellElement");
testTag("thead", "HTMLTableSectionElement");
testTag("title", "HTMLTitleElement");
testTag("tr", "HTMLTableRowElement");
testTag("tt", "HTMLElement");
testTag("u", "HTMLElement");
testTag("ul", "HTMLUListElement");
testTag("var", "HTMLElement");
testTag("wbr", "HTMLElement");
testTag("xmp", "HTMLPreElement");
// Not yet tested:
// CSSCharsetRule
// CSSFontFaceRule
// CSSImportRule
// CSSMediaRule
// CSSPageRule
// CSSRule
// CSSVariablesRule
// CSSKeyframeRule
// CSSKeyframesRule
// CSSValue
// SVGColor
// SVGPaint
// SVGZoomEvent
// Conditional elements, VIDEO, RUBY, DATALIST_ELEMENT, METER_ELEMENT.
// the various window sub-objects
// what else is missing?
if (window.testRunner)
testRunner.notifyDone();
}
function frameLoaded()
{
runTest();
}
</script>
<iframe id="xmlframe" onload="frameLoaded()" style="height:0px" src="data:application/xhtml+xml,<?xml version='1.0' encoding='UTF-8'?><body/>"></iframe>
</body>
</html>