- From: David Choi <daaave@gmail.com>
- Date: Fri, 29 Jun 2007 22:49:19 -0400
- To: "Patrick Garies" <pgaries@fastmail.us>
- Cc: "Rene Saarsoo" <nene@triin.net>, public-html@w3.org
- Message-ID: <212037bd0706291949t2b549126u82589253f7f10b08@mail.gmail.com>
> 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. > > Only in extreme cases where it's the only appropriate thing to do, as a JavaScript developer, will I even consider making stylesheet changes via the DOM. Getting scripts to work cross browser on that front is incredibly painful. PPK took a shot at it a while back, and had to resort to using an "ugly kludge". This page is a good highlight of the problems involved, though: http://www.quirksmode.org/dom/changess.html It's possible that this is going outside of the scope of this working group, but for even the simplest DHTML work, the style property is essential. I agree, though, that the style attribute isn't conforming, and even if it were, the JavaScript style property would be infinitely more useful simply returning computed styles, rather than the value of the style attribute. However, that raises a problem with implementation logistics when setting style rules (i.e. what are you setting, if not the inline style?) for an element, which may or may not have an id attribute. I haven't got a solution to propose here, but making changes to the stylesheet itself isn't a solution so far as I'm concerned for the problem of changing styles on specific elements via JavaScript. - Dave Choi
Received on Saturday, 30 June 2007 18:52:39 UTC