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

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

Issue 1530643003: Support slot element's fallback content feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 11 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/fast/dom/shadow/v1-slots-api-in-v0.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 function convertTemplatesToShadowRootsWithin(node) { 85 function convertTemplatesToShadowRootsWithin(node) {
86 var nodes = node.querySelectorAll("template"); 86 var nodes = node.querySelectorAll("template");
87 for (var i = 0; i < nodes.length; ++i) { 87 for (var i = 0; i < nodes.length; ++i) {
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 || mode == 'v0'){
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"); 98 var expose = template.getAttribute("data-expose-as");
99 if (expose) 99 if (expose)
100 window[expose] = shadowRoot; 100 window[expose] = shadowRoot;
101 if (template.id) 101 if (template.id)
102 shadowRoot.id = template.id; 102 shadowRoot.id = template.id;
103 var fragments = document.importNode(template.content, true); 103 var fragments = document.importNode(template.content, true);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 return node; 354 return node;
355 } 355 }
356 356
357 return null; 357 return null;
358 }; 358 };
359 359
360 if (!window.internals) 360 if (!window.internals)
361 return null; 361 return null;
362 return iter(root, id); 362 return iter(root, id);
363 } 363 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-in-v0.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698