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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/spec/parsing.html

Issue 2592333002: Push-pop custom elements reaction stack when the parser inserts elements (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="resources/custom-elements-helpers.js"></script> 4 <script src="resources/custom-elements-helpers.js"></script>
5 <body> 5 <body>
6 <script> 6 <script>
7 'use strict'; 7 'use strict';
8 8
9 // Looks up the preceeding element (which should be a template 9 // Looks up the preceeding element (which should be a template
10 // element) and creates a Promise test. The test name is taken from 10 // element) and creates a Promise test. The test name is taken from
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 </template> 61 </template>
62 <script> 62 <script>
63 'use strict'; 63 'use strict';
64 64
65 test_with_content((w) => { 65 test_with_content((w) => {
66 assert_array_equals(w.invocations, 66 assert_array_equals(w.invocations,
67 ['constructor', 'x="y"', 'connected', 'script']); 67 ['constructor', 'x="y"', 'connected', 'script']);
68 }); 68 });
69 </script> 69 </script>
70 70
71 <template data-test="foreign content insertion executes connected">
72 <script>
73 'use strict';
74
75 customElements.define('a-a', class extends HTMLElement {
76 constructor() {
77 super();
78 }
79 connectedCallback() {
80 window.connectedChildNodeCount = this.childNodes.length;
81 }
82 });
83 </script>
84 <a-a><div></div></a-a>
85 </template>
86 <script>
87 'use strict';
88
89 test_with_content((w) => {
90 assert_equals(w.connectedChildNodeCount, 0,
91 'the parser should have run the connected callback when inserting the ' +
92 'element, before continuing tree construction');
93 });
94 </script>
95
71 <template data-test="element creation failure produces unknown element"> 96 <template data-test="element creation failure produces unknown element">
72 <script> 97 <script>
73 'use strict'; 98 'use strict';
74 99
75 customElements.define('a-a', class extends HTMLElement { 100 customElements.define('a-a', class extends HTMLElement {
76 constructor() { 101 constructor() {
77 super(); 102 super();
78 103
79 // Returning this different, in-use element causes element 104 // Returning this different, in-use element causes element
80 // creation to fail in 105 // creation to fail in
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 'the element should have been created successfully'); 323 'the element should have been created successfully');
299 324
300 let elements = f.detached.querySelectorAll('a-a'); 325 let elements = f.detached.querySelectorAll('a-a');
301 console.log(f.invocations[0].parentNode); 326 console.log(f.invocations[0].parentNode);
302 assert_equals(elements.length, 2, 327 assert_equals(elements.length, 2,
303 'two elements should have been created'); 328 'two elements should have been created');
304 assert_equals(Object.getPrototypeOf(elements[1]), w.HTMLElement.prototype, 329 assert_equals(Object.getPrototypeOf(elements[1]), w.HTMLElement.prototype,
305 'the second element should be un-upgraded, not failed'); 330 'the second element should be un-upgraded, not failed');
306 }); 331 });
307 </script> 332 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698