W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Proposal for limited :matches pseudoclass

From: Simetrical <simetrical@gmail.com>
Date: Thu, 31 Jul 2008 18:52:17 -0400
Message-ID: <7c2a12e20807311552q7fef4f3g69edae26d59e6d55@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "www-style list" <www-style@w3.org>

On Thu, Jul 31, 2008 at 6:21 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> I'm not sure I get you here.  Given "foo + bar", a DOM mutation could
> certainly recompute the style of descendants.  It would simply be the
> descendants of bar that possibly get recomputed styles, whereas in
> foo:matches(+ bar) it's foo's descendants that may need recomputation.  Is
> there something I'm overlooking here that allows you to avoid recomputing
> styles upon a DOM mutation if you use the "foo + bar" rule?

It depends on the mutation, I guess.  If you were to insert a new
"bar" after foo, which is a very common case (right?), it would have
no descendants that need to be recomputed.  If you were to delete a
"bar" after foo, again, no recomputation for descendants.  Only if you
change an element after foo that already has descendants to match
"bar" will you need to recompute "bar"'s descendants.  But in all
three cases you would have to recompute the descendants of "foo".

Of course, you could also change the element before bar to match foo.
In this case I guess it's reversed: you'll then have to recompute all
of bar's descendants for "foo + bar", but for "foo:matches(+ bar)"
you'd only have to recompute foo and its descendants, which is no
extra cost.  I guess that's what you're saying.

I don't really know.  Maybe I don't understand after all.  Or maybe
this isn't a problem at all for sibling selectors, only child or
descendant selectors.
Received on Thursday, 31 July 2008 22:52:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT