W3C home > Mailing lists > Public > www-style@w3.org > December 2011

Re: <style scoped>: matching the scoping element and :first-child et al

From: Yehuda Katz <wycats@gmail.com>
Date: Fri, 9 Dec 2011 08:59:50 -0800
Message-ID: <CAMFeDTUPQ9vgvUcfUROB6uGgGdkWCim36Zbj04ZysotRCTfxgg@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Roland Steiner <rolandsteiner@chromium.org>, www-style@w3.org, Ian Hickson <ian@hixie.ch>, Alex Russell <slightlyoff@google.com>, Dominic Cooney <dominicc@google.com>
Yehuda Katz
(ph) 718.877.1325


On Fri, Dec 9, 2011 at 8:39 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Thu, Dec 8, 2011 at 10:57 PM, Roland Steiner
> <rolandsteiner@chromium.org> wrote:
> > Hi all,
> >
> > As I am implementing the new version of <style scoped> I came across
> another
> > edge case question:
> >
> > In the upcoming version, a selector matches up to, and including, the
> > scoping element (i.e., the parent element of <style scoped>). Now, how
> > should pseudo-classes be handled on selectors that match the scoping
> > element? E.g.
> >
> > <div>
> >     <div>...</div>
> >     <div>
> >         <style scoped>
> >             div:first-child { ... }
> >             div:first-of-type {  ... }
> >             div:nth-child(2) { ... }
> >             div:nth-of-type(2) { ... }
> >             div:last-child { ... }
> >             div:last-of-type { ... }
> >             div:nth-last-child(2) { ... }
> >             div:nth-last-of-type(2) { ... }
> >         </style>
> >     </div>
> >     <div>...</div>
> > <div>
> >
> > On one hand, 'div:first-child' et al still only match the scoping <div>
> > element, and thus should be applicable. OTOH, the pseudo-classes draw
> > information from outside the sub-tree. I personally slightly tend towards
> > allowing it, but could easily be swayed by good arguments otherwise.
> >
> > What do others think?
>
> Definitely allow it.  It's not only good sense (to me), but it also
> keeps with the design principle that scoping should generally be
> similar to just appending an id to all the selectors.
>

Agreed.


>
> ~TJ
>
>
Received on Friday, 9 December 2011 17:00:45 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:47 GMT