Re: Wiki page for style attribute

On 3 Jul 2007, at 0920, Eric Daspet wrote:

> On 7/2/07, Anne van Kesteren <annevk@opera.com > wrote:
>> On Mon, 02 Jul 2007 01:52:51 +0200, Sam Ruby <rubys@us.ibm.com>  
>> wrote:
>> > Anne van Kesteren wrote:
>> >>  2. Syndication is also addressed by <style scope>.
>> >
>> > Fully disagree.
>>
>> I said "also". Could you please elaborate on why you disagree with  
>> that?
>
> I do not see how "style scoped" could be a solution for  
> syndication. And, more generaly, I do not see how someone could  
> benefit from "style scoped" to put some external pieces of HTML  
> into a main document.
>
> In the wiki, the [style scoped][1] is expected to solve the use  
> cases [external material][2] and [embedding][3]. I do not think  
> this is the case.
>
> [1]: http://esw.w3.org/topic/HTML/StyleAttribute#style-element-scoped
> [2]: http://esw.w3.org/topic/HTML/StyleAttribute#external-material
> [3]: http://esw.w3.org/topic/HTML/StyleAttribute#embedding
>
> Let's face some concrete code
>
>     <html>
>     <head>
>       <title>test</title>
>       <style title="main"> background-color: blue ; color: white ;  
> </style>
>     </head>
>     <body>
>       <h1>Syndication : articles :</h1>
>       <article>
>         <style title="external material" scoped> color: blue ; </ 
> style>
>         <p>My external paragraph integrated in the main document</p>
>       </article>
>     </body>
>     </html>
>
> * Problem :
>
> I own the "main" document, you own the external material. I can't  
> be sure of the appearence of the integrated material, because you  
> could change the external styles. You can't be sure of the  
> appearence either, because you do not control my stylesheet. In my  
> example I define a default "white on blue" color. The external  
> material expect the usual white background and define a blue color.  
> The result is blue on blue, noone is "in fault".
>
> A solution could be an agreement between me and the author of the  
> external content. However if we do so, it would be simplier and  
> better to agree on common classnames with some style attached.  
> Moreover, this does not solve the syndication probleme because I do  
> not know all external authors a I won't be able to ask them to  
> change something.
>
> An other solution is avoiding conflicts. In this case it could be  
> redefine the background-color in the external stylesheet. However,  
> as the owner I can't be sure that all the external authors will do  
> it, especially in the syndication use case. Even if external  
> authors are smart, it is difficult to avoid conflicts. External  
> authors have to care about selectors priorities (they don't know  
> mines), fonts (size, color, spacing, indentation), position  
> (position absolute, relative, floats that could overlap, if a clear  
> breaks something in my design ...), doctype switching (the external  
> material could be in html 4 with the quirks mode, and me in html 5  
> triggering standard mode) ...
>
>
> In no way (AFAIK) either me either the external author could be  
> sure that the external material is even readable. At least I do not  
> see how this is doable in the syndication use case.
>
> Well, there is *one* way I can see : if I control both stylesheets.  
> But if I control both, I am able to put them both in the head  
> section with precise selectors.


Wouldn't the same problem happen if the external material defined  
it's appearance with style attributes? Anne's suggestion was that  
scoped style elements would cover the use case of externally-sourced  
fragments at least as well as the style attribute would. The problem  
you point out doesn't seem to have bearing on that suggestion.

Although, on further reflection, it would seem that perhaps the  
problem you point out is an argument *for* using scoped style for  
externally sourced fragments. The only way to ensure that the  
external fragment matches your document's styling would be to strip  
any inline style from the fragment. To that end, removing a style  
element would seem to be simpler than removing a number of style  
attributes.

scott.

Received on Tuesday, 3 July 2007 16:29:08 UTC