W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2013

Re: [whatwg] scoped style sheets and @-rules

From: Glenn Maynard <glenn@zewt.org>
Date: Tue, 5 Mar 2013 18:04:32 -0600
Message-ID: <CABirCh9We0MVnb+xYT1RTTaBUDEZvbwULckNiE3d_Uufx2WOUA@mail.gmail.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: whatwg@whatwg.org
On Mon, Mar 4, 2013 at 11:33 AM, L. David Baron <dbaron@dbaron.org> wrote:

> > You could make the same argument against most of @scoped: you don't need
> to
>
 > define a scoped style for a class, just use a different class name.
>
> I think for the rest of @scoped, there are both significant
> performance and encapsulation advantages.
>

The encapsulation advantages are identical for @font-face and the rest of
@scoped.  Redefining "font-family: serif" to a different serif font using
@font-face is just like redefining <b> to use a brighter color instead of a
bold font.  In both cases, you could argue that you don't need @scoped, but
those arguments are against all of @scoped, not specific to font-family.

One of the big problems with @font-face is that it's not obvious
> whether the @font-face rules should be scoped to:
>
>   1. font-family declarations in the scoped style sheet, or
>
>   2. elements in the style sheet's scope, whether the declarations
>      came from the scoped style sheet or not
>

I think #2 should be obvious to anybody who understands CSS.  In any case,
if a couple people expect #1, that's fine--they'll try it, immediately see
what actually happens and learn that it's #2.  That's the same level of
education that every feature requires.

Option (2) is more reasonably implementable, but I'm not sure it's
> what authors expect.  In particular, it implies changes to fonts
> that are inherited in from outside the scoped style sheet.  It's not
> clear to me that this behavior is useful enough to authors to be
> worth the (still not insubstantial) work of implementing it.
>

It's natural that I'd be able to make changes to inherited fonts, just like
I can make changes to anything else inherited from other stylesheets.  You
can already change fonts that are already defined (eg. you can redefine
"serif"), that isn't new to @scoped.

This just seems like an arbitrary exception, disabling one random piece of
CSS that's just as useful and natural to use with @scoped as everything
else.

-- 
Glenn Maynard
Received on Wednesday, 6 March 2013 00:04:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 6 March 2013 00:04:58 GMT