W3C home > Mailing lists > Public > www-style@w3.org > January 2010

Re: proposal for a new css combinator

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 14 Jan 2010 07:51:16 -0600
Message-ID: <dd0fbad1001140551u5fca9ed4v6b99efcec8bb7e2@mail.gmail.com>
To: Alan Gresley <alan@css-class.com>
Cc: Niels Matthijs <niels.matthijs@internetarchitects.be>, Boris Zbarsky <bzbarsky@mit.edu>, www-style list <www-style@w3.org>
On Thu, Jan 14, 2010 at 6:41 AM, Alan Gresley <alan@css-class.com> wrote:
> So you are saying that you want to match the first descendant of a
> particular element in the DOM. This could be done like first-child and would
> be a structural pseudo-class.

Yeah, that's what's desired, but note that multiple elements can match
here.  For example, in the following code:

    <p>bar bar bar</p>
  <div class=special>

A selector like "article % section" should match both the first child
of article, and the section inside of the div.  It wouldn't match the
section containing "baz", though, since that has another section
ancestor between it and its closest article ancestor.

> .focusBlock header:first-descendant {
> // style rules //
> }
> In theory you could also have last-descendant.
> .focusBlock header:last-descendant {
> // style rules //
> }

:last-descendant would actually be marginally easier to implement, if
I'm thinking correctly, and plenty useful on its own (for many of the
same reasons that jQuery's closest() method is so useful).

Received on Thursday, 14 January 2010 13:52:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:42 UTC