- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Fri, 8 Aug 2014 22:40:45 -0700
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: Anne van Kesteren <annevk@annevk.nl>, "www-dom@w3.org" <www-dom@w3.org>
On Fri, Aug 8, 2014 at 6:31 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote: > On 8/8/14, 6:02 PM, Tab Atkins Jr. wrote: >> I think this does what you want? >> http://dev.w3.org/csswg/selectors/#match-against-element > > Looks like it, modulo the same observability issues Anne's current setup > has. If selector matching ever becomes observable, we've got to settle on a matching algorithm in general, not just for this simple case. The spec still talks about matching in the natural way, evaluating the selector from left to right, rather than from right to left as browsers tend to do. I could possibly restate the entire algorithm in terms of right-to-left evaluation, but that would entail a rather more involved rewriting of the semantics of the combinators and everything that talks about matching even indirectly. The algorithm also gets significantly more complex in the RTL direction, due to context issues: when evaluating LTR, you definitely *start* by looking at the elements visible in your current context; to do RTL, you have to break up the selector along context-crossing combinators and evaluate each chunk (in LTR order) individually. ~TJ
Received on Saturday, 9 August 2014 05:41:33 UTC