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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-upgrade.html

Issue 2173623003: Add "Failed" custom element state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid multiple toElement 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 <title>Custom Elements: Custom Element State "Failed" in Upgrades</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="resources/custom-elements-helpers.js"></script>
6 <body>
7 <script>
8 'use strict';
9
10 // Custom Element State
11 // https://dom.spec.whatwg.org/#concept-element-custom-element-state
12
13 test_with_window(w => {
14 let document = w.document;
15 let element = document.createElement('a-a');
16
17 let constructorCount = 0;
18 w.customElements.define('a-a', class extends w.HTMLElement {
19 constructor() {
20 constructorCount++;
21 throw new Error();
22 }
23 connectedCallback() {
24 assert_unreached('connectedCallback should not be invoked if constructor t hrew');
25 }
26 });
27
28 // Upgrade calls the constructor.
29 // 9. If constructResult is an abrupt completion, then
30 // Set element's custom element state to "failed".
31 // https://html.spec.whatwg.org/multipage/scripting.html#upgrades
32 let container = document.body;
33 container.appendChild(element);
34 assert_equals(constructorCount, 1, 'constructor should be invoked once');
35
36 // "failed" is not "defined"
37 // https://dom.spec.whatwg.org/#concept-element-defined
38 assert_false(element.matches(':defined'));
39 });
40 </script>
41 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698