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

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-create.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, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-create.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-create.html b/third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-create.html
new file mode 100644
index 0000000000000000000000000000000000000000..2c56c248fad8f9e798da55f3098e4a5101625862
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/state-failed-create.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<title>Custom Elements: Custom Element State "Failed" in document parser</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="resources/custom-elements-helpers.js"></script>
+<body>
+<template id="test-content">
+ <script>
+'use strict';
+window.logs = [];
+customElements.define('a-a', class extends HTMLElement {
+ constructor() {
+ super();
+ logs.push('constructor');
+ throw new Error();
+ }
+ connectedCallback() {
+ logs.push('connected');
+ }
+});
+ </script>
+ <a-a></a-a>
+</template>
+<script>
+'use strict';
+
+// Custom Element State
+// https://dom.spec.whatwg.org/#concept-element-custom-element-state
+// Set to "failed" in step 7 of "create an element for a token"
+// https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token
+
+// This test loads the template content into iframe.srcdoc because "create an
+// element for a token" with synchronous custom elements flag set to true is
+// used only in document parser.
+
+test_with_window(w => {
+ let logs = w.logs;
+ assert_equals(logs.length, 1, 'Only constructor should be invoked');
+ assert_equals(logs[0], 'constructor', 'The 1st action should be constructor');
+}, undefined, document.getElementById('test-content').innerHTML);
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698