Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / imported / web-platform-tests / custom-elements / instantiating-custom-elements / extensions-to-document-interface / create-element-type-is-a-local-name.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Document.createElement() and Document.createElementNS() create custom element of type, specified by single localName 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">
12 </head>
13 <body>
14 <div id="log"></div>
15 <script>
16 test(function() {
17     var doc = newHTMLDocument();
18     var name = 'x-a';
19     var GeneratedConstructor = doc.registerElement(name);
20     var customElement = doc.createElement(name);
21
22     assert_equals(Object.getPrototypeOf(customElement), GeneratedConstructor.prototype,
23         'Custom element type should be the local name of the custom element');
24 }, 'Test Document.createElement() creates custom element of type, ' +
25     'specified by single localName argument');
26
27
28 test(function() {
29     var doc = newHTMLDocument();
30     var name = 'x-b';
31     var GeneratedConstructor = doc.registerElement(name);
32     var customElement = doc.createElementNS(HTML_NAMESPACE, name);
33     assert_equals(Object.getPrototypeOf(customElement), GeneratedConstructor.prototype,
34         'Custom element type should be the local name of the custom element');
35 }, 'Test Document.createElementNS() creates custom element of type, ' +
36     'specified by localName argument. Argument typeExtension is not passed');
37 </script>
38 </body>
39 </html>