| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| Test HTMLUnknownElement |
| <p> |
| This test verifies the following: |
| <ol> |
| <li>The <code><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#htmlunknownelement">HTMLUnknownElement</a></code> |
| interface is used for HTML elements that are not defined by the HTML5 |
| specification (or other applicable specifications). |
| <li>The <code><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#htmlunknownelement">HTMLUnknownElement</a></code> |
| interface is <b>not</b> used for HTML elements that <b>are</b> defined |
| by the HTML5 specification (or other applicable specifications). |
| </ol> |
| </p> |
| </p> |
| <div id="console"></div> |
| |
| <b></b> |
| <foo1></foo1> |
| <foo2></foo2> |
| |
| <font></font> |
| <h1></h1> |
| <table></table> |
| |
| <script> |
| // These tags are required by the HTML spec |
| var validTags = ["div", "font", "h1", "table"]; |
| |
| // These tags are manufactured and should not be recognized by any browser |
| var bogusTags = ["foo1", "foo2"]; |
| |
| var allTags = validTags.concat(bogusTags); |
| |
| function isBogusTag (tag) { |
| for (var k in bogusTags) { |
| var bogusTag = bogusTags[k]; |
| if (tag == bogusTag) { |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| var DynamicElements = new Array(); |
| |
| for (var k in allTags) { |
| var tag = allTags[k]; |
| DynamicElements[tag] = document.createElement(tag); |
| } |
| |
| for (var element in DynamicElements) { |
| shouldBeTrue("DynamicElements[\"" + element + "\"]" + " instanceof HTMLElement"); |
| if (isBogusTag(element)) { |
| shouldBeTrue("DynamicElements[\"" + element + "\"]" + " instanceof HTMLUnknownElement"); |
| } else { |
| shouldBeFalse("DynamicElements[\"" + element + "\"]" + " instanceof HTMLUnknownElement"); |
| } |
| } |
| |
| var staticElements = new Array(); |
| |
| for (var k in allTags) { |
| var tag = allTags[k]; |
| staticElements[tag] = document.getElementsByTagName(tag)[0]; |
| } |
| |
| for (var staticElement in staticElements) { |
| if (staticElements[staticElement]) { |
| if (isBogusTag(staticElement)) { |
| shouldBeTrue("staticElements[\"" + staticElement + "\"]" + " instanceof HTMLUnknownElement"); |
| } else { |
| shouldBeFalse("staticElements[\"" + staticElement + "\"]" + " instanceof HTMLUnknownElement"); |
| } |
| } |
| } |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |