Re: XBL in CSS

Laurens Holst wrote:
> Matthew Raymond schreef:
>>> And if you want strange effects in a page, I think 
>>> it is acceptable when that requires a transclusion (a Java applet, a 
>>> bit of SVG, etc.)
>>>     
>>    Why would you want to pollute your beautifully semantic (X)HTML with
>> a bunch of markup that's only there for presentational purposes? If the
>> effect isn't important to the content, it makes much more sense to
>> include it via a style sheet binding, especially if this effect is going
>> to be on every web page on your website and you're not using a server
>> based application to build your pages dynamically.
> 
> That makes no sense. You already ‘pollute’ your XML / HTML with 
> reference(s) to style sheet(s), so I do not see the argument here.

   I'm not sure what you mean. You have the <link> and <style> elements,
but those elements aren't in the document body, and you have to have
some way to attach styling to begin with. If you mean the |class| and
|id| attributes, those have purposes other than styling. You have the
|style| attribute, but I personally don't think there should ever have
been a |style| attribute, since it serves no semantic purpose.

> Given that the markup depends on the presence of XBL for its behaviour, 
> it seems strange to me to reference it a. indirectly, and b. from a 
> within a presentation language.

   But the whole point is that the markup and scripted behavior is
presentational rather than semantic. For instance, imagine a <canvas>
element that's used for purely presentational animations. Now think of
how you'd do a different animation for every alternate style, or have an
alternate style that doesn't have the animation. The user wouldn't be
able to change the styling through their browser's page style selection,
so you'd have to rig up some Internet Explorer-esque hack to allow them
an interface to change the style sheet along with the animation type.

   So you see, you claim indirection, but that's because the markup is
associated with a specific style, while you're looking at the markup as
being associated with the document. You wonder why you'd want to bind
from a presentational language, but the whole point is that the markup
is presentational. Think of it as if the XBL binding is an
implementation of a CSS property.

   Now, granted, if there is no presentational purpose to the binding,
or there is considerable behavioral functionality, then you should
probably bind via markup. XBL 2.0 fully supports binding via markup.
There is some potential for misuse, but I don't think it's worth
throwing out the baby with the bathwater.

> In the contrary, I think it makes more sense to refer to the XBL 
> stylesheet directly from the XML (or HTML) file, and let the binding to 
> specific elements be done in the XBL itself (through the ‘element’ 
> attribute).
> 
> This would also keep prevention of the cycle that fantasai mentioned 
> within the XBL domain, and not pull it into the CSS implementations.

   How does Mozilla solve this problem with XBL 1.0?

Received on Tuesday, 5 September 2006 09:41:25 UTC