- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Thu, 31 Jan 2013 21:35:42 -0500
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- CC: www-style list <www-style@w3.org>
On 1/31/13 9:23 PM, Tab Atkins Jr. wrote: > Wait, getComputedStyle is a live object? Yes. And yes, that makes it an incredible pain to implement. > Nah, let's just return a dead object. It's for when you do need to request multiple > properties, without having to retype the function multiple times (or > get the UA to recompute things multiple times, if it can save effort > by combining things). There's a good chance that returning a dead object, which must therefore have computed values for all the properties, will take more time than computing 2 or 3 property values even if you have to duplicate some work... A quick glance in Gecko suggests that we currently support about 300 properties, not counting shorthands. And I would expect that number to grow significantly if the current pattern of css3/4 modules breaking up existing properties into 4-5 shorthands continues. Maybe UAs can internally optimize by returning an object which can produce dead values of properties on demand but doesn't actually compute them until asked... Gecko can sort of do that maybe, at times, kinda (yes, lots of caveats). Can't speak for others. In any case, seems like this use case argues for being able to not pass a property name but still pass in a value type and pseudo-element, right? That does argue for using a dictionary for the argument... -Boris
Received on Friday, 1 February 2013 02:36:10 UTC