W3C home > Mailing lists > Public > www-style@w3.org > August 2006

Re: Selector for parent/predecessor?

From: Kelly <lightsolphoenix@gmail.com>
Date: Sun, 20 Aug 2006 19:33:29 -0400
To: David Hyatt <hyatt@apple.com>
Cc: mark.birbeck@x-port.net, www-style@w3.org
Message-Id: <200608201933.37829.lightsolphoenix@gmail.com>

Hash: SHA1

I have to fully agree with that.  For example, take nth-last-child().

Every time I check out the state of implementing nth-child() and 
nth-of-type(), I notice that developers don't want to touch them until 
someone figures out an efficient way of implementing nth-last-child() and 
nth-last-of-type() as well.  The problem is, both run against the generic CSS 
processing model and will likely always be inefficient to implement.  On top 
of that, I don't see use cases where having nth-last-child() would be more 
convinient than having nth-child() instead...

I don't believe for a second that a parent selector would be difficult to 
implement (the XML model SAYS you'd have to know the parent of an element by 
the time you're ready to style it); the question is, would having a parent 
selector make authors ask for an ancestor selector?  And then, what would 
happen if an author combined a parent selector with a dynamic pseudoclass, 
like :hover?

On Sunday, August 20, 2006 7:10 pm, David Hyatt wrote:
> A parent selector is also extremely difficult to implement,
> especially dynamic cases.
> Any selector that cannot be determined correctly during an
> incremental load of a document is evil, since you end up possibly
> having to display incorrect results while loading before the true
> style of the element can be accurately determined.  This includes
> selectors like :last-child for example.  It's just terrible to have
> any selectors in the language that can be wrong during a forward
> parse of the document.
> Far and away the most efficient way to style elements is with simple
> efficient selectors like class, tag and ID.  All the extra selectors
> do (especially most of the useless ones from CSS3) is provide authors
> with more rope to hang themselves with.
> dave
> (hyatt@apple.com)

- -- 
http://www.mozilla.org/products/firefox/ - Get Firefox! 
http://www.mozilla.org/products/thunderbird/ - Reclaim Your Inbox! 
Please avoid sending me Word or PowerPoint attachments. 
See http://www.gnu.org/philosophy/no-word-attachments.html
Version: GnuPG v1.4.5 (GNU/Linux)

Received on Sunday, 20 August 2006 23:35:10 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:25 UTC