Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / w3c / web-platform-tests / custom-elements / registering-custom-elements / definition-construction-algorithm-name-is-null.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>If NAME is null then localName must be set to TYPE</title>
5 <meta name="author" title="Vasiliy Degtyarev" href="mailto:vasya@unipro.ru">
6 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
7 <meta name="assert" content="If NAME is null then localName must be set to TYPE">
8 <link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
9 <script src="../../../../resources/testharness.js"></script>
10 <script src="../../../../resources/testharnessreport.js"></script>
11 <script src="../testcommon.js"></script>
12 <link rel="stylesheet" href="../../../../resources/testharness.css">
13 </head>
14 <body>
15 <div id="log"></div>
16 <script>
17 test(function() {
18     var doc = newHTMLDocument();
19     var name = 'x-a';
20     var proto = Object.create(HTMLElement.prototype);
21     var GeneratedConstructor = doc.registerElement(name, {prototype: proto});
22     var customElement = new GeneratedConstructor();
23
24     assert_equals(customElement.localName, name, 'LocalName should be a type in case of ' +
25         'attempt to register a custom element and local name is not provided');
26 }, 'If NAME is not specified then localName must be set to TYPE');
27
28
29 test(function() {
30     var doc = newHTMLDocument();
31     var name = 'x-b';
32     var proto = Object.create(HTMLElement.prototype);
33     var GeneratedConstructor = doc.registerElement(name, {prototype: proto, extends: null});
34     var customElement = new GeneratedConstructor();
35
36     assert_equals(customElement.localName, name, 'LocalName should be a type in case of ' +
37         'attempt to register a custom element and name is null');
38 }, 'If NAME is null then localName must be set to TYPE');
39 </script>
40 </body>
41 </html>