- From: Jonas Sicking <jonas@sicking.cc>
- Date: Thu, 7 Feb 2013 04:20:41 +0000
- To: "L. David Baron" <dbaron@dbaron.org>
- Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Boris Zbarsky <bzbarsky@mit.edu>, www-style list <www-style@w3.org>
On Fri, Feb 1, 2013 at 2:25 AM, L. David Baron <dbaron@dbaron.org> wrote: > On Thursday 2013-01-31 18:11 -0800, Tab Atkins Jr. wrote: >> On Thu, Jan 31, 2013 at 5:43 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote: >> > On 1/31/13 8:18 PM, Tab Atkins Jr. wrote: >> >> Next step is figuring out if there is implementor interest in exposing >> >> this information, and then someone writing it up in the CSSOM spec. >> > >> > This information being specified/cascaded style values? >> > >> > There's certainly interest from me. ;) >> >> 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. >> >> Thoughts? > > I'd actually rather have separate methods or (probably preferably) > getters for each sort of value we'd want to return (the set is > pretty small) than have string arguments for "specified", > "computed", etc. > > For example, maybe something like: > element.specifiedStyle.color > element.computedStyle.color > element.usedStyle.color > element.pseudoStyle("::before").specifiedStyle.color This syntax means that you have to choose between two potentially bad options: A) element.*Style returns a "live" object which whose .color property always is up-to-date. Or at least is up-to-date as long as the element is in the document and is being rendered. B) element.specifiedStyle returns a full non-live snapshot of all CSS properties. And element.specifiedStyle == element.specifiedStyle is false. B seems bad to me for both reasons mentioned. A seems quite ok to me, but there were some unpleasant sounds coming from Tab earlier in this thread at the mention of live objects. But I think the implementation of the theLiveSpecifiedStyleObject.color getter would simply call whatever internal function element.getStyle("color", "", "specified") would call. / Jonas
Received on Thursday, 7 February 2013 04:21:38 UTC