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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/imports/imports-and-synchronous-create.html

Issue 2242743002: Make custom elements work in HTML imports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip (CustomElementsRegistry.cpp change is gone) Created 4 years, 4 months 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 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 'use strict';
6
7 let reactions = [];
8
9 test(() => {
10 customElements.define('x-x', class extends HTMLElement {
11 constructor() {
12 super();
13 reactions.push({ type: 'constructor', element: this });
14 }
15 });
16 assert_array_equals(reactions, []);
17 }, 'Should not have parsed <x-x> yet');
18 </script>
19
20 <x-x></x-x>
21
22 <script>
23 'use strict';
24
25 async_test((test) => {
26 test.step(() => {
27 assert_equals(reactions.length, 1);
28 }, 'Parser should invoke the custom element constructor');
29
30 let import1 = document.createElement('link');
31 import1.rel = 'import';
32 import1.href = 'resources/import-custom.html';
33 document.head.appendChild(import1);
34
35 import1.onload = test.step_func_done(() => {
36 let elementsInMaster = document.querySelector('x-x');
37 let elementsInImport = import1.import.querySelector('x-x');
38 let elements = reactions.map(e => e.element);
39
40 assert_array_equals(elements, [elementsInMaster, elementsInImport],
41 'Constructor should run in the order elements are create d');
42 });
43 }, 'Constructor should run in the order elements are created');
44 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698