Re: Why the style attribute shouldn't be abandoned

Rene Saarsoo wrote:
> 3. It's really useful for debugging
>
> It's clearly THE easiest ways to style a single element.
> Quick and dirty prototyping anyone?
I would guess that, like a lot of other things, UAs are required to 
support it, but the attribute is not considered conforming. That means 
that you can still debug with it; you just won’t be able to use it in a 
production document, assuming that you care about validity and/or 
conformance.

Rene Saarsoo wrote:
> So, is the <style> element evil and should be dropped?
>
> No, because when I have styles, that are specific to
> just one document, then there is no big reason to create
> extra CSS file for those styles.
>
> Similarly with @style and <style>. If you have just
> one element in one document, that you want to style in
> a specific and unique way, then there is no logical reason
> to make up new #id or .class.
Style sheets that are only relevant to one page should appear within a 
style element. It would seem to be good practice to keep them all in 
that element rather than on a bunch of elements strewn about the 
document. This way, all style information is in one place and things are 
easier to maintain. Considering the numerous types of selectors and the 
document structure, it may be totally unnecessary to add class or ID 
attributes.

Rene Saarsoo wrote:
> 5. What about JavaScript style property?
>
> Even when we remove @style, the JavaScript style property
> will still have to remain. And it clearly should, because
> how else could you animate elements and do other dynamic
> stuff like that?
There are other methods that can be used to dynamically alter the CSS:
1. DOM Core via manipulation of class attributes, style elements, and/or 
link elements
2. DOM2 Style
3. CSSOM

I suppose that they’re not as convenient if you want to target a single 
element and change only a few properties though.

Rene Saarsoo wrote:
> The only reason seems to be, that using @style is
> mostly bad practice and having it available, encourages
> all those bad practices.
>
> But even if we remove the @style from the spec, it will
> still be available for authors. Only those authors who
> read the spec or use validator, will notice the change.
> But aren't those the authors who would abandon those
> bad practices anyway?
Keeping the attribute in its HTML4 form doesn’t seem to solve those 
problems either.

Received on Saturday, 30 June 2007 01:00:30 UTC