Re: Selector for parent/predecessor?

-----BEGIN PGP SIGNED MESSAGE-----
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFE6PFRvCLXx0V8XHQRAofrAJ9dUONeVxr4+lwJEOI3okaQMuBKIwCffXjE
p/ulgr86XS5ZnopSWQ9J/1g=
=teAS
-----END PGP SIGNATURE-----

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