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

Re: [css3-cascade] style attribute should override scoped style sheets

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sun, 2 Dec 2012 12:49:19 -0800
Message-ID: <CAAWBYDCcyNL5nd9=ROaKANs66KBr-e3D-jZgiDHJF2mZs8bfOw@mail.gmail.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: Fran├žois REMY <francois.remy.dev@outlook.com>, www-style list <www-style@w3.org>
On Sun, Dec 2, 2012 at 11:48 AM, L. David Baron <dbaron@dbaron.org> wrote:
> On Sunday 2012-12-02 10:29 -0800, Tab Atkins Jr. wrote:
>> On Sun, Dec 2, 2012 at 10:03 AM, Fran├žois REMY
>> <francois.remy.dev@outlook.com> wrote:
>> > |  On further though, if we do make that change, we'll still want a style
>> > |  attribute targetting a child to win over a scoped stylesheet scoped to
>> > |  that child, I think.
>> >
>> > Are you sure? Normally, a stylesheet always win to an attribute, right? Why
>> > would we want to break that?
>>
>> I'm not sure I'm parsing you right, but a style attribute always beats
>> a non-!important rule from a stylesheet.  This is preserving that.
>>
>> In case my description wasn't clear, I was referring to something like this:
>>
>> <div style="> :first-child { color: green; }">
>>   <p>
>>     <style scoped> :scope { color: red; } </style>
>>     foo
>> </div>
>>
>> I think we want the text to be green.
>
> I'm not sure we want that style attribute feature at all (and I
> wasn't thinking about it earlier in this thread).
>
> But if we do, I'd want the text to be red, because the scope of the
> <style scoped> is inside the scope of the style attribute.
>
> In other words, I'd want the style attribute's cascading rules to be
> defined in terms of scope.

I could do it that way instead, sure.  They're equally easy to spec.

I assume that in the following the text should be green?

<p style="color: green;">
  <style scoped>:scope { color: red; }</style>
  foo
</p>

In other words, style attributes are scoped "more tightly" than a
scoped stylesheet?

~TJ
Received on Sunday, 2 December 2012 20:50:09 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:03 GMT