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

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

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂

Received on Friday, 1 February 2013 03:15:27 UTC