- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 12 Oct 2012 14:36:33 -0400
- To: www-style list <www-style@w3.org>
Proposal: a getDefaultComputedStyle method that acts just like getComputedStyle but returns what the style would be if it were not for author rules. Rationale: jQuery has hacks to try to figure out default styles, involving creation of subframes and so forth. These hacks are very fragile. There's got to be a better way for libraries to do this sort of thing. IDL: CSSStyleDeclaration getDefaultComputedStyle(Element elt, optional DOMString pseudoElt); Behavior is just like getComputedStyle except: 1) Ignores all author-level sheets, transitions, animations, override stylesheets. 2) Never returns used styles, only computed ones (just like getComputedStyle would for a display:none element). My implementation at the moment also ignores presentational hints, but I'm open to changing that if people think it would be better to include them. See also https://bugzilla.mozilla.org/show_bug.cgi?id=800983 for the implementation and https://bugzilla.mozilla.org/show_bug.cgi?id=797029 for the jQuery issues that prompted this suggestion. The jQuery folks sound like they would really like something like this, for what it's worth. -Boris
Received on Friday, 12 October 2012 18:37:02 UTC