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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/shadow/resources/shadow-dom.js

Issue 1514233003: Make assignedSlot return null for a slot in a closed shadow tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v1-slots
Patch Set: rebased Created 5 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/LayoutTests/fast/dom/shadow/v1-slots-api-with-closed-shadow-tree.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 function createShadowRoot() 1 function createShadowRoot()
2 { 2 {
3 var children = Array.prototype.slice.call(arguments); 3 var children = Array.prototype.slice.call(arguments);
4 if ((children[0] instanceof Object) && !(children[0] instanceof Node)) 4 if ((children[0] instanceof Object) && !(children[0] instanceof Node))
5 return attachShadow.apply(null, children); 5 return attachShadow.apply(null, children);
6 return {'isShadowRoot': true, 6 return {'isShadowRoot': true,
7 'children': children}; 7 'children': children};
8 } 8 }
9 9
10 // TODO(kochi): This is not pure attachShadow wrapper, but also handles createSh adowRoot() 10 // TODO(kochi): This is not pure attachShadow wrapper, but also handles createSh adowRoot()
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 var template = nodes[i]; 88 var template = nodes[i];
89 var mode = template.getAttribute("data-mode"); 89 var mode = template.getAttribute("data-mode");
90 var parent = template.parentNode; 90 var parent = template.parentNode;
91 parent.removeChild(template); 91 parent.removeChild(template);
92 var shadowRoot; 92 var shadowRoot;
93 if (!mode) { 93 if (!mode) {
94 shadowRoot = parent.createShadowRoot(); 94 shadowRoot = parent.createShadowRoot();
95 } else { 95 } else {
96 shadowRoot = parent.attachShadow({'mode': mode}); 96 shadowRoot = parent.attachShadow({'mode': mode});
97 } 97 }
98 var expose = template.getAttribute("data-expose-as");
99 if (expose)
100 window[expose] = shadowRoot;
98 if (template.id) 101 if (template.id)
99 shadowRoot.id = template.id; 102 shadowRoot.id = template.id;
100 var fragments = document.importNode(template.content, true); 103 var fragments = document.importNode(template.content, true);
101 shadowRoot.appendChild(fragments); 104 shadowRoot.appendChild(fragments);
102 105
103 convertTemplatesToShadowRootsWithin(shadowRoot); 106 convertTemplatesToShadowRootsWithin(shadowRoot);
104 } 107 }
105 } 108 }
106 109
107 function isShadowHost(node) 110 function isShadowHost(node)
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 return node; 354 return node;
352 } 355 }
353 356
354 return null; 357 return null;
355 }; 358 };
356 359
357 if (!window.internals) 360 if (!window.internals)
358 return null; 361 return null;
359 return iter(root, id); 362 return iter(root, id);
360 } 363 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-with-closed-shadow-tree.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698