- From: <bugzilla@jessica.w3.org>
- Date: Fri, 01 Mar 2013 21:05:41 +0000
- To: public-webapps-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21166 Bug ID: 21166 Summary: [Shadow]: The olderShadowRoot property should be defined on ShadowRoot Classification: Unclassified Product: WebAppsWG Version: unspecified Hardware: PC OS: All Status: NEW Severity: normal Priority: P2 Component: Component Model Assignee: dglazkov@chromium.org Reporter: dominicc@chromium.org QA Contact: public-webapps-bugzilla@w3.org Blocks: 14978 Defining olderShadowRoot on HTMLShadowElement is inconvenient for code that wants to walk the list of ShadowRoots. It is necessary to write something like: function forEachShadowRoot(host, f) { for (var s = host.shadowRoot; s; s = olderShadowRootOf(s)) { f(s); } } function olderShadowRootOf(s) { var shadowElements = s.querySelectorAll('shadow'); for (var i = 0; i < shadowElements.length; i++) { var shadowElement = shadowElements[i]; if (shadowElement.olderShadowRoot) { return shadowElement.olderShadowRoot; } } // There were no shadow elements, or they were all inert shadowElement = document.createElement('shadow'); s.appendChild(shadowElement); var result = shadowElement.olderShadowRoot; shadowElement.remove(); return result; } This seems excessively complicated for this use case; it would be better if olderShadowRoot was defined on ShadowRoot, then one could simply write the loop in a straightforward way: function forEachShadowRoot(host, f) { for (var s = host.shadowRoot; s; s = s.olderShadowRoot) { f(s); } } -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Friday, 1 March 2013 21:05:42 UTC