4 <title>Document.createElement() and Document.createElementNS() create custom element of type, specified by typeExtension argument</title>
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
6 <meta name="assert" content="Let TYPE be typeExtension, or localName if typeExtension is not present">
7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#extensions-to-document-interface-to-instantiate">
8 <script src="../../../../../resources/testharness.js"></script>
9 <script src="../../../../../resources/testharnessreport.js"></script>
10 <script src="../../testcommon.js"></script>
11 <link rel="stylesheet" href="../../../../../resources/testharness.css">
17 var doc = newHTMLDocument();
18 HTML5_ELEMENTS.forEach(function(tagName) {
19 var obj = doc.createElement(tagName);
20 var name = 'x-a-' + tagName;
21 var proto = Object.create(obj.constructor.prototype);
22 var GeneratedConstructor = doc.registerElement(name, {prototype: proto, extends: tagName});
23 var customElement = doc.createElement(tagName, name);
25 assert_equals(Object.getPrototypeOf(customElement), GeneratedConstructor.prototype,
26 'Custom element type should be ' + name);
28 }, 'Test Document.createElement() creates custom element of type, ' +
29 'specified by typeExtension argument');
33 var doc = newHTMLDocument();
34 HTML5_ELEMENTS.forEach(function(tagName) {
35 var obj = doc.createElement(tagName);
36 var name = 'x-b-' + tagName;
37 var proto = Object.create(obj.constructor.prototype);
38 var GeneratedConstructor = doc.registerElement(name, {prototype: proto, extends: tagName});
39 var customElement = doc.createElementNS(HTML_NAMESPACE, tagName, name);
41 assert_equals(Object.getPrototypeOf(customElement), GeneratedConstructor.prototype,
42 'Custom element type should be ' + name);
44 }, 'Test Document.createElementNS() creates custom element of type, ' +
45 'specified by typeExtension argument');