W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2012

Re: Element.style setter

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Fri, 31 Aug 2012 14:24:14 +0200
To: Joćo Eiras <joaoe@opera.com>
Cc: "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <7ja148df5hd3n3q2nq7b73i2f7ik1q7ceo@hive.bjoern.hoehrmann.de>
* Joćo Eiras wrote:
>Opera allows element.style to be set with a css fragment, like
>
># element.style = 'background:green'
>
>which maps to
>
># element.setAttribute('style', 'background:green');
>
>Others do not support this (throw an error due to being a read-only  
>property), but it makes the code less verbose.

Short of changing all interfaces that provide object-oriented access to
a string value like the contents of the style attribute, I don't see how
this would be anything but a bug in Opera if it is indeed not supported
elsewhere. Allowing this results in odd situations like `a != b` right
after setting `a = b`; given that you can just access .cssText instead,
or indeed the individual properties, I do not really see a win here.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Friday, 31 August 2012 12:24:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 31 August 2012 12:24:56 GMT