New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement document.querySelectorAll and document.querySelector #851
Comments
@JoonWonLee See http://mxr.mozilla.org/servo/source/src/components/script/layout_interface.rs#38 for examples of messages we send to the layout task right now. |
Hrm. Why would the layout task be involved in this in any way? |
I believe that a node's style information is only accessible from the layout task's view of a node. @SimonSapin could confirm this. |
The compute values for a given element are stored in "layout data", but that’s unrelated to these Selector APIs. For this you’ll want to parse a selector with |
Probably a good testcase is http://dom.spec.whatwg.org itself - it uses querySelector() internally. |
Relevant spec: http://dom.spec.whatwg.org/ |
So I started following the steps that @SimonSapin suggested above, exporting both
|
For the long term, you may actually want a different selector-matching algorithm for querySelector than for the selector matching layout does, since the problem spaces are pretty different in various ways.... That said. I wouldn't expect selector matching to rely on layout-side data in any way. Why does it? |
In the long term yes. In the meantime, simply going through the entire (sub)tree and filtering on a boolean test is better than not having the feature at all. Selector matching does not rely on layout-side data. In order to avoid circular dependencies between crates, selector matching is defined over an abstract traits for nodes. Only |
@brunoabinader Is this something you're working on right now? If not, is your existing work somewhere that another person could build upon? It would be nice to knock this out, and we have people sniffing around for tasks. |
@jdm yes, I have a patch in progress, though I'm stuck with the TNode > AbstractNode issue, I believe if someone could help me on this it'd be really good - I am currently also updating other reviewed patches so I'll just upload the current state of this patch for comments. |
I'm not exactly sure what the problem is. Implementing |
Blocks #2185. |
Indeed @jdm, by that time there was no JS implementation, hopefully things are now simpler to implement. I'll revisit my code and apply the updates accordingly. |
…ions Add tests that check addHitRegion throws NotSupportedError
Needed for #841.
The text was updated successfully, but these errors were encountered: