-
Notifications
You must be signed in to change notification settings - Fork 48
Implement newly proposed DOM selection approach #474
Conversation
@@ -7,6 +7,41 @@ | |||
|
|||
var HTMLCollection = scope.wrappers.HTMLCollection; | |||
var NodeList = scope.wrappers.NodeList; | |||
var wrap = scope.wrapIfNeeded; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep this as wrapIfNeeded to avoid confusion
Before this PR can be merged, please sign the CLA. See the CONTRIBUTING guide. |
I'd already received confirmation that the MediaMath's (corporate) CLA had been accepted ([email protected]), do I need to send a copy somewhere else? |
Got it. Thanks for the heads up. |
Thanks for signing the CLA! |
else if (target instanceof OriginalDocument) | ||
list = originalDocumentQuerySelectorAll.call(target, selector); | ||
|
||
if (!list) // occurs when when this/target -> ShadowRoot/DocumentFragment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about?
// When we get a ShadowRoot the logical tree is going to be disconnected so we do a manual tree traversal
Any reason this is not just the else branch?
if (target instanceof OriginalElement)
list = originalElementQuerySelectorAll.call(target, selector);
else if (target instanceof OriginalDocument)
list = originalDocumentQuerySelectorAll.call(target, selector);
else
return findElements(this, index, result, p, selector, null);
LGTM once you fix the curlies for the if/else. (You can use curlies for all if/else if you want too). Can you squash these into a single commit? We usually include "Fixes #N" in the commit message too. |
Ah, to do a squash on the commits do I need a new pull-request (on a new branch? (I'm unfamiliar with the process I'm afraid) |
No need for a new PR or a new branch: http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request |
All squashed |
Implement newly proposed DOM selection approach
Thanks you guys. :) We'll check it out. |
Filed an issue seems to be related to this change. https://github.com/Polymer/ShadowDOM/issues/476 |
(Very new to pull-request work-flow). In order to address this, must I do a brand new pull-request? |
Yeah. A new pull request seems appropriate. |
There may be some possible improvements for selecting light-DOM nodes in a shadow-rooted element with no contained content element -- I also tried querying the whole DOM natively and traversing it instead of the wrapped tree (https://gist.github.com/jcmoore/69a49f887e03c1d2bfa1#file-queryselector2-js) but it was no faster than the original method, and probably had significant memory implications.