Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / imported / web-platform-tests / custom-elements / registering-custom-elements / unresolved-elements-interface-html-element.html
blob4b05359e5433a18e531e4f2c7fed4d5b4fcf0340
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Unresolved element interface must be HTMLElement, if the namespace is HTML Namespace</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="When an unresolved element is created, it's element interface must be HTMLElement, if the namespace is HTML Namespace">
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 doc.body.innerHTML = '<x-a id="x-a"></x-a>';
20 var customElement = doc.querySelector('#x-a');
22 assert_not_equals(customElement, null, 'Unregistered custom element should not be null');
24 assert_class_string(customElement, 'HTMLElement',
25 'Unresolved custom element must be a HTML element');
26 }, 'Test interface of unresolved element, created via innerHTML property');
29 test(function() {
30 var doc = newHTMLDocument();
31 var customElement = doc.createElement('x-b');
33 assert_class_string(customElement, 'HTMLElement',
34 'Unresolved custom element must be a HTML element');
35 }, 'Test interface of unresolved element, created by Document.createElement');
38 test(function() {
39 var doc = newHTMLDocument();
40 var customElement = doc.createElementNS(HTML_NAMESPACE, 'x-c');
42 assert_class_string(customElement, 'HTMLElement',
43 'Unresolved custom element must be a HTML element');
44 }, 'Test interface of unresolved element, created by Document.createElementNS');
47 testInIFrame('../resources/x-element.html', function(doc) {
48 var customElement = doc.getElementById('x-element');
50 assert_not_equals(customElement, null, 'Unregistered custom element should not be null');
52 assert_class_string(customElement, 'HTMLElement',
53 'Unresolved custom element must be a HTML element');
54 }, 'Test unresolved element interface in loaded HTML document');
55 </script>
56 </body>
57 </html>