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

Re: Access to element styles?

From: Braden N. McDaniel <braden@shadow.net>
Date: Mon, 29 Mar 1999 02:35:29 -0500
Message-ID: <00ff01be79b7$7e63d340$213a11cf@com>
To: <dbaron@fas.harvard.edu>, <www-dom@w3.org>
----- Original Message -----
From: L. David Baron <dbaron@fas.harvard.edu>
To: <braden@endoframe.com>; <dbaron@fas.harvard.edu>; <www-dom@w3.org>
Sent: Sunday, March 28, 1999 3:19 PM
Subject: Re: Access to element styles?

> 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
> > > 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
> > does?
> You might want to set/get individual properties.

Good point. It does seem like too much to ask to expect script authors to
parse a string for this information.

> 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].

Yes, I found that after making my previous posting.

> 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.

Me too.

I remain of the opinion that a better model would forego this direct
manipulation of styles on elements altogether, in favor of an exclusive
binding of the scripting language to the style sheet. Thus script has the
ability to modify only the stylesheet itself at runtime. The style rules
applied to an element can be modified in the document by changing the
element's class or id at runtime.

These techniques could be consolidated in a behaviors syntax similar
philosophically (but different syntactically) to Netscape's CAS. It is
unfortunate that the current description of CAS is tied to the CSS style

Received on Monday, 29 March 1999 02:41:01 UTC

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