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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/imports/attribute-changed-callback.html

Issue 2312613002: Fix 'will execute script' condition for creating custom elements in imports (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-elements/imports/resources/attribute-parsercreate.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <link id="import1" rel="import" href="resources/attribute-upgrade.html">
5 <script>
6 'use strict';
7
8 let reactions = [];
9
10 customElements.define('a-a', class extends HTMLElement {
11 static get observedAttributes() { return ['attr']; }
12 attributeChangedCallback() {
13 reactions.push(this);
14 }
15 });
16 </script>
17 <link id="import2" rel="import" href="resources/attribute-parsercreate.html">
18 <script>
19 'use strict';
20
21 test(() => {
22 let importDoc1 = import1.import;
23 let importDoc2 = import2.import;
24
25 let a = importDoc1.querySelector('#a');
26 let b = importDoc1.querySelector('#b');
27 let c = importDoc2.querySelector('#c');
28 let d = importDoc2.querySelector('#d');
29
30 assert_array_equals(reactions, [b, d],
31 'attributeChangedCallback should be called for both upgrad e and create.');
32
33 reactions = [];
34
35 a.setAttribute('attr', 'a');
36 b.setAttribute('attr', 'b');
37 c.setAttribute('attr', 'c');
38 d.setAttribute('attr', 'd');
39
40 assert_array_equals(reactions, [a, b, c, d],
41 'attributeChangedCallback should be called for setAttribut e().');
42
43 reactions = [];
44
45 d.removeAttribute('attr', 'd');
46 c.removeAttribute('attr', 'c');
47 b.removeAttribute('attr', 'b');
48 a.removeAttribute('attr', 'a');
49
50 assert_array_equals(reactions, [d, c, b, a],
51 'attributeChangedCallback should be called for removeAttri bute().');
52 }, 'attributeChangedCallback should be invoked for elements in import');
53 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-elements/imports/resources/attribute-parsercreate.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698