Re: Proposal for a new element instead of <style scoped>

2007/7/3, Rene Saarsoo:
>
> As many have pointed out [1][2], style element with scoped
> attribute is not backwards compatible.
>
>      Current user-agents apply the contents of <style scoped>
>      to all elements - clearly not an acceptable fallback.
>      Meaning, that authors can't really use it before most
>      of the user-agents support it, which could take about
>      5 years or something.
>
>      This goes against the don't-break-the-web principle.
>
> To resolve this problem, I propose a new element instead.
> e.g. <localstyle> or <scopedstyle>.
>
>      The word "localstyle" seems to me easier to spell and
>      understand than "scopedstyle".
>
> Authors can use HTML comments to hide contents of the new
> element from older user-agents (like back in the old days
> with <style>):
>
>      <localstyle type="text/css"><!--
>       /* my special styles for really new browsers */
>      --></localstyle>
>
> That would greatly resolve the backwards compatibility problem.

I propose an alternative: adopting http://www.w3.org/TR/css-style-attr

Pros:
 * it's a CSS WG working draft
 * syntax could then probably be reused in non-HTML documents (XHTML2
for instance)
 * no need for the pseudo-comment (though it is part of the CSS syntax
so its really a "code presentation" matter)

Cons:
 * some might find it less readable than an element
 * does not allow specifying a per-style media type (the media type is
the one given by the Content-Style-Type HTTP header or <meta
http-equiv="Content-Style-Type">, or the UA default one), but is
anybody actually using anything other than CSS (text/css)?

-- 
Thomas Broyer

Received on Tuesday, 3 July 2007 19:27:45 UTC