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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/imports/sync-create-element-order.html

Issue 2242743002: Make custom elements work in HTML imports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses tkent's comments. 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 let test = async_test('Constructor should run in the order elements are created' );
10
11 test.step(() => {
12 customElements.define('x-x', class extends HTMLElement {
13 constructor() {
14 super();
15 reactions.push(this);
16 }
17 });
18 assert_array_equals(reactions, [], 'Should not have parsed <x-x> yet');
19 });
20 </script>
21
22 <x-x></x-x>
23
24 <script>
25 'use strict';
26
27 test.step(() => {
28 assert_equals(reactions.length, 1, 'Parser should invoke the custom element co nstructor');
29 });
30
31 let import1 = document.createElement('link');
32 import1.rel = 'import';
33 import1.href = 'resources/import-custom.html';
34
35 // TODO(kochi): crbug.com/640465 synchronous creation fails in imports.
36 import1.onload = test.step_func_done(() => {
37 let elementsInMaster = document.querySelector('x-x');
38 let elementsInImport = import1.import.querySelector('x-x');
39
40 assert_array_equals(reactions, [elementsInMaster, elementsInImport],
41 'Constructor should run in the order elements are created' );
42 });
43
44 document.head.appendChild(import1);
45 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698