W3C home > Mailing lists > Public > www-dom@w3.org > January to March 1999

Re: Access to element styles?

From: L. David Baron <dbaron@fas.harvard.edu>
Date: Sun, 28 Mar 1999 15:19:01 -0500 (EST)
Message-Id: <199903282019.PAA08075@login5.fas.harvard.edu>
To: braden@endoframe.com, dbaron@fas.harvard.edu, www-dom@w3.org
On Thu, 18 Mar 1999 02:17:34 -0500, "Braden N. McDaniel"
(braden@shadow.net) wrote:
> ----- Original Message -----
> From: L. David Baron <dbaron@fas.harvard.edu>
> To: <www-dom@w3.org>
> Sent: Thursday, March 11, 1999 3:17 PM
> Subject: Access to element styles?
> > Are there any plans for the DOM Level 2 to allow access to the CSS
> > properties of a specific element?  The DOM Level 1 hinted at this in a
> > comment [1] that the style attribute of the HTMLElement interface was
> > reserved for future use.  Could this style attribute be of type
> > CSS2Properties [2]?  (Yes, I know that limits the style language.
> > Perhaps there should be access to the Content-Style-Type first set by a
> > META or HTTP header.  But then the property names are messy.  Would
> > part of it be better off being a function that adds a declaration to a
> > STYLE attribute?)
> Why not just have it take a string value, the same way the STYLE attribute
> does?

You might want to set/get individual properties.

But actually, the STYLE attribute part is already taken care of (in
section 4.4.2 of the 1999-03-04 draft), by the style attribute of
HTMLElement2 [1].

So I guess what I really meant to ask about was whether there would be
some way te get (but there would be no need to set) the current
cascaded style on any element.  One could do the setting through the
style attribute [2], but might want to see the current cascaded value
through something like currentStyle (as I believe MSIE implements).  If
it would be too difficult to make the values within currentStyle
readonly, then setting currentStyle could be made equivalent to setting

I worry that saying style is of type CSSStyleDeclaration is too
CSS-specific.  But I don't know how else to provide the same features.

One final note:  the parentRule attribute of CSSStyleDeclaration should
probably be defined as being null if the parent is not a CSSRule.


[1] http://www.w3.org/TR/WD-DOM-Level-2/css.html#Level-2-CSS-htmlelement2
[2] but, as I've said before, it would be nice if it had a specificity
of 1000.  See the references and comments of my previous post:

L. David Baron    Freshman, Harvard    dbaron@fas.harvard.edu
Links, SatPix, CSS, etc.  < http://www.fas.harvard.edu/~dbaron/ >
WSP CSS AC                < http://www.webstandards.org/css/ >
Received on Sunday, 28 March 1999 15:19:03 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:05 UTC