Re: About dropping the style attribute

On 6/26/07, Ara Pehlivanian <> wrote:
> On 6/26/07, James Craig <> wrote:
> >
> > Jens Meiert wrote:
> >
> > >> I've realized now that the current spec drops the style attribute for
> > >> all elements except for the <font>, but I can't understand the
> > >> reasoning behind those decisions.
> > >
> > > And neither do I, and according to my experience as well as the
> > > discussion on that subject there are several cases why we need to
> > > keep the "style" attribute.
> >
> > Some of the common JavaScript libraries use this for performance and
> > consistency reasons, too. Prototype, for example, uses the [style] to
> > toggle style values for a couple reasons. 1) So it doesn't have to
> > override !important styles, and 2) because when checking the
> > displayed state, performance of getAttribute is much faster than
> > getComputedStyle.
> >
> > James
> >
> >From a strictly pragmatic point of view, dropping the style attribute
> will break a lot of apps on the web. In particular applications that
> use the attribute in conjunction with server side injected CSS for
> dynamic background images, color coding, etc... (whether it's correct
> to do so or not).
> Likewise, the as stated by James, a lot of JS libraries (and homegrown
> JS code) depend on the style attribute from anything like simple
> show/hide functionality to more complex color fading and position
> animation.
> Just my 2 cents,
> A.

could you explain how is exactly that web apps will be broken? as far
as i can see it, UAs should *only* drop the style attribute IF under
HTML5 rendering mode. Keep your app in HTML4/XHTML1 if you wan't to
continue using old tags/attributes. That's the way actual UAs work,
switching between quirks and standards compliant mode depending on the
doctype, and rendering/dropping specific attributes. [1]

Moreover, UAs will definitely need a diferent parsing/rendering path
to treat the new tags, and *only* render them as they are supposed
under HTML5 mode... the same should be applied to dropped and
deprecated tags/attributes.
And I don't know where in the specs does this belong, but we should be
discouraging UAs developers from "trying to fix tag soups" and treat
the DOM in a strict mode, where any invalid tag/attribute is just
dropped instead of being pseudo-fixed and rendered.

[1] a clear example of this is IE6, that when under standards
compliant mode it uses a different box model and prohibits coloring of
scrollbars (you can specify it, but it gets dropped)

PS: I know i may be "asking too much" but there are so many wrong
things in the current status of the web, that fixing just one is
impossible as you must fix lots others first.


Received on Wednesday, 27 June 2007 18:36:22 UTC