W3C home > Mailing lists > Public > www-style@w3.org > February 2013

Re: [cssom] Proposal for obtaining robust style information via Javascript - getStyle()

From: L. David Baron <dbaron@dbaron.org>
Date: Thu, 31 Jan 2013 19:15:01 -0800
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, www-style list <www-style@w3.org>
Message-ID: <20130201031501.GA20975@crum.dbaron.org>
On Thursday 2013-01-31 18:23 -0800, Tab Atkins Jr. wrote:
> On Thu, Jan 31, 2013 at 6:21 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> > On 1/31/13 9:11 PM, Tab Atkins Jr. wrote:
> >> In that case, let's get this done.  Francois' outline of a solution
> >> earlier in this thread sounds great to me.  The only thing I'd change
> >> is to make the property name optional too, in which case it's
> >> identical to calling getComputedStyle() on the element.
> >
> > So it returns a string if you pass in the property name but a random live
> > object if you don't?
> Wait, getComputedStyle is a live object?  Jeezus.  Nah, let's just
> return a dead object.  It's for when you do need to request multiple

Returning a dead object would be substantially more expensive in
many cases.

For example, today getComputedStyle(elt, "").color doesn't require
flushing layout.  If getComputedStyle() returned a dead object, it
would require flushing layout, and also making lots of copies.

(This is one of the contexts where returning a live object is much
simpler than returning a dead one.  Some contexts are the other way


𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂
Received on Friday, 1 February 2013 03:15:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:26 UTC