Re: Scoped style sheets.

On Tue, Jul 15, 2008 at 2:22 PM, Ian Hickson <ian@hixie.ch> wrote:

> On Tue, 15 Jul 2008, Tab Atkins Jr. wrote:
> >
> > Just to make it completely clear, take this document:
> > <style>
> >   #content p { color: red; }
> > </style>
> > <body>
> >   <header>header content...</header>
> >   <article id="content">
> >     <style scoped>
> >       p { color: blue }
> >     </style>
> >     <p>article content...</p>
> >   </article>
> > </body>
>
> I don't understand why anyone creating such syndicated documents would
> ever have any rules with #content in the selector as part of their global
> style sheet if they _didn't_ want to override the syndicated style sheet.


To provide a default styling for the content.  I would think it's preferable
to style content in *some* way to go along with the site's theme, even if
the article author can then style it differently.


> > 2)  Your argument is that the global author should have an easy way to
> > override the scoped styles.  Why is this?
>
> Because in the case of a syndicated document stream, the article author
> writes and styles his content first, and then the syndicator takes those
> files and merges them, at which point he can do touch-ups. You don't
> publish the frame before you have the content.


You're limiting yourself to a very narrow use-case, one which doesn't seem
to require the automated control that <style scoped> offers.  If an article
is manually editted by the syndicator after the author is done with it but
before the article is published, then it's trivial to go through and
manually ensure that the given styles are targeted appropriately.

I had thought that the entire *purpose* of <style scoped> was to help out
when there *is* no manual editting, such as on a site primarily filled with
user-generated content.  In these cases one cannot possibly manually edit
all the content that passes through, but allowing users the ability to style
their content is still a desirable goal.

The person who writes the style sheet last is the one who should get the
> ability to easily override the styles.


I agree, but I would think that the author of the scoped styles would be the
last one to write a style in the user-generated content use-case that I
thought this was addressing.  Even in your provided case I would assume that
the scoped styles were written well after the global site styles.  (As noted
previously, I assumed that global styles would target into the scoped area
to provide a default styling, not to do a final styling.)

~TJ

Received on Tuesday, 15 July 2008 21:16:32 UTC