| Index: third_party/WebKit/LayoutTests/custom-elements/imports/imports-and-synchronous-create.html
|
| diff --git a/third_party/WebKit/LayoutTests/custom-elements/imports/imports-and-synchronous-create.html b/third_party/WebKit/LayoutTests/custom-elements/imports/imports-and-synchronous-create.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8c487c2a62e29cf2971190aea654485029833bfa
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/custom-elements/imports/imports-and-synchronous-create.html
|
| @@ -0,0 +1,44 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script>
|
| +'use strict';
|
| +
|
| +let reactions = [];
|
| +
|
| +test(() => {
|
| + customElements.define('x-x', class extends HTMLElement {
|
| + constructor() {
|
| + super();
|
| + reactions.push({ type: 'constructor', element: this });
|
| + }
|
| + });
|
| + assert_array_equals(reactions, []);
|
| +}, 'Should not have parsed <x-x> yet');
|
| +</script>
|
| +
|
| +<x-x></x-x>
|
| +
|
| +<script>
|
| +'use strict';
|
| +
|
| +async_test((test) => {
|
| + test.step(() => {
|
| + assert_equals(reactions.length, 1);
|
| + }, 'Parser should invoke the custom element constructor');
|
| +
|
| + let import1 = document.createElement('link');
|
| + import1.rel = 'import';
|
| + import1.href = 'resources/import-custom.html';
|
| + document.head.appendChild(import1);
|
| +
|
| + import1.onload = test.step_func_done(() => {
|
| + let elementsInMaster = document.querySelector('x-x');
|
| + let elementsInImport = import1.import.querySelector('x-x');
|
| + let elements = reactions.map(e => e.element);
|
| +
|
| + assert_array_equals(elements, [elementsInMaster, elementsInImport],
|
| + 'Constructor should run in the order elements are created');
|
| + });
|
| +}, 'Constructor should run in the order elements are created');
|
| +</script>
|
|
|