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 / custom-element-type-local-name.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Instantiation of custom element: custom element type is given via the local name of the custom element</title>
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
6 <meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
7 <meta name="assert" content="The custom element type is given to a custom element at the time of its instantation in one of the two ways: 1. As the local name of the custom element.">
8 <link rel="help" href="http://www.w3.org/TR/custom-elements/#instantiating-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 GeneratedConstructor = doc.registerElement('x-a');
20     doc.body.innerHTML = '<x-a id="x-a"></x-a>';
21     var customElement = doc.querySelector('#x-a');
22     assert_equals(Object.getPrototypeOf(customElement), GeneratedConstructor.prototype,
23         'Custom element type should be the type, specified by the local name of ' +
24         'the custom element');
25 }, 'Test custom element type, which is given via the local name of the custom element. ' +
26     'Custom element created via innerHTML property');
27
28
29 testInIFrame('../resources/x-element.html', function(doc) {
30     var GeneratedConstructor = doc.registerElement('x-element');
31     var xelement = doc.querySelector('#x-element');
32     assert_equals(Object.getPrototypeOf(xelement), GeneratedConstructor.prototype,
33         'Custom element type should be the type, specified by the local name of ' +
34         'the custom element');
35 }, 'Test custom element type, which is given via the local name of the custom element. ' +
36     'Custom element is defined in loaded HTML document');
37 </script>
38 </body>
39 </html>