Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/custom-elements/parser/parser-constructs-custom-elements.html

Issue 2434563008: Import wpt@26c8d4e87448d1c4e5ebf2ddb4917c0633c201db (Closed)
Patch Set: Mark one more test as potentially timing out Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Custom Elements: Changes to the HTML parser</title>
5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
6 <meta name="assert" content="HTML parser creates a custom element">
7 <link rel="help" href="https://html.spec.whatwg.org/#create-an-element-for-the-t oken">
8 <link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
9 <script src="/resources/testharness.js"></script>
10 <script src="/resources/testharnessreport.js"></script>
11 </head>
12 <body>
13 <div id="log"></div>
14 <my-custom-element id="instance1"></my-custom-element>
15 <script>
16
17 class MyCustomElement extends HTMLElement { };
18
19 test(function () {
20 var customElement = document.getElementById('instance1');
21
22 assert_true(customElement instanceof HTMLElement, 'An unresolved custom elem ent must be an instance of HTMLElement');
23 assert_false(customElement instanceof MyCustomElement, 'An unresolved custom element must NOT be an instance of that custom element');
24 assert_equals(customElement.localName, 'my-custom-element');
25 assert_equals(customElement.namespaceURI, 'http://www.w3.org/1999/xhtml', 'A custom element HTML must use HTML namespace');
26
27 }, 'HTML parser must NOT create a custom element before customElements.define is called');
28
29 customElements.define('my-custom-element', MyCustomElement);
30
31 </script>
32 <my-custom-element id="instance2"></my-custom-element>
33 <script>
34
35 test(function () {
36 var customElement = document.getElementById('instance2');
37
38 assert_true(customElement instanceof HTMLElement, 'A resolved custom element must be an instance of HTMLElement');
39 assert_false(customElement instanceof HTMLUnknownElement, 'A resolved custom element must NOT be an instance of HTMLUnknownElement');
40 assert_true(customElement instanceof MyCustomElement, 'A resolved custom ele ment must be an instance of that custom element');
41 assert_equals(customElement.localName, 'my-custom-element');
42 assert_equals(customElement.namespaceURI, 'http://www.w3.org/1999/xhtml', 'A custom element HTML must use HTML namespace');
43
44 }, 'HTML parser must create a defined custom element before executing inline scr ipts');
45
46 </script>
47 </body>
48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698