You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is equivalent to div > (.hello AND .world > span), which would be written as div.world > span.hello. This is a bit unexpected, as the spec would suggest the following as the result:
I ran into this issue while making an attempt at fixing #22 but this seems to be a prerequisite to implementing child selectors. Since the parent combinator is associative, it's also possible to parse the query as left associative instead of right associative:
which seems to be easier for eventually implementing child selectors, since you can match a node to the right and its parent to the left. That assumes you have access to the parent though, which is part of how I had been planning on implementing the parent selector. Otherwise, you'd likely have to approach it top-down.
To fix this issue though, it seems like one would need to add a bit more complexity to the query selector parser to handle precedence. I believe this is what @kelko was running into with and and or operations in #22.
The text was updated successfully, but these errors were encountered:
tslnc04
added a commit
to tslnc04/tl
that referenced
this issue
Apr 27, 2024
If we have the query selector
div > .hello.world > span
, the current query selector parser produces the following result:This is equivalent to
div > (.hello AND .world > span)
, which would be written asdiv.world > span.hello
. This is a bit unexpected, as the spec would suggest the following as the result:I ran into this issue while making an attempt at fixing #22 but this seems to be a prerequisite to implementing child selectors. Since the parent combinator is associative, it's also possible to parse the query as left associative instead of right associative:
which seems to be easier for eventually implementing child selectors, since you can match a node to the right and its parent to the left. That assumes you have access to the parent though, which is part of how I had been planning on implementing the parent selector. Otherwise, you'd likely have to approach it top-down.
To fix this issue though, it seems like one would need to add a bit more complexity to the query selector parser to handle precedence. I believe this is what @kelko was running into with
and
andor
operations in #22.The text was updated successfully, but these errors were encountered: