- From: Simon Pieters <simonp@opera.com>
- Date: Wed, 24 Apr 2013 13:50:59 +0200
- To: "www-style list" <www-style@w3.org>, "Boris Zbarsky" <bzbarsky@mit.edu>
On Fri, 12 Oct 2012 20:36:33 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote: > 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. Done. https://dvcs.w3.org/hg/csswg/rev/4311a171b0cb I think presentational hints are supposed to be like author-level styles, so I didn't 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 -- Simon Pieters Opera Software
Received on Wednesday, 24 April 2013 11:51:36 UTC