Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / imported / web-platform-tests / custom-elements / registering-custom-elements / unresolved-elements-interface-html-unknown-element.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Unresolved element interface must be HTMLUnknownElement, if the namespace is neither HTML Namespace nor SVG Namespace</title>
5 <meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
6 <meta name="assert" content="When an unresolved element is created, it's element interface must be HTMLUnknownElement, if the namespace is neither HTML Namespace nor SVG Namespace">
7 <link rel="help" href="http://www.w3.org/TR/custom-elements/#registering-custom-elements">
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 var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
17
18 test(function() {
19     var doc = newHTMLDocument();
20     doc.body.innerHTML =
21         '<math xmlns="' + MATHML_NAMESPACE + '">' +
22             '<x-a id="x-a"></x-a>' +
23         '</math>';
24     var xa = doc.querySelector('#x-a');
25
26     assert_not_equals(xa, null, 'Unregistered custom element should not be null');
27
28     // According https://code.google.com/p/chromium/issues/detail?id=336377
29     // expected class string is Element
30     assert_class_string(xa, 'Element', 'Unresolved custom element must be an Element');
31 }, 'Test interface of unresolved element with MathML namespace, created via innerHTML property');
32
33
34 test(function() {
35     var doc = newHTMLDocument();
36     var xa = doc.createElementNS(MATHML_NAMESPACE, 'x-b');
37
38     assert_class_string(xa, 'Element',
39         'Unresolved custom element must be a HTMLUnknownElement');
40 }, 'Test interface of unresolved element with MathML namespace, ' +
41     'created by Document.createElementNS');
42
43
44 testInIFrame('../resources/x-mathml-element.html', function(doc) {
45     var customElement = doc.getElementById('x-math-element');
46
47     assert_not_equals(customElement, null, 'Unregistered custom element should not be null');
48
49     assert_class_string(customElement, 'Element',
50         'Unresolved custom element must be a Element');
51 }, 'Test interface of unresolved element in loaded HTML document with embedded MathML elements');
52 </script>
53 </body>
54 </html>