Open
Bug 544343
Opened 14 years ago
Updated 2 years ago
Need a method to get "specified style" (faster than and different from "computed style")
Categories
(Core :: DOM: CSS Object Model, enhancement, P5)
Tracking
()
NEW
People
(Reporter: sroussey, Unassigned)
References
Details
(Keywords: perf)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 Build Identifier: The current getComputedStyle returns used style for some properties, but not for others.[1] This is requiring a relayout, and full restyling of the document.[1] In many cases, this exact information not needed or desired, but rather a faster method is preferred. IE supports something called currentStyle [3] that returns the computed style (not used style), and without guarantees. This results in some heavy JS pages running faster in IE6 than Firefox 3.6 with JIT.[4] [1] https://bugzilla.mozilla.org/show_bug.cgi?id=385260#c11 [2] https://bugzilla.mozilla.org/show_bug.cgi?id=385260#c7 [3] http://msdn.microsoft.com/en-us/library/ms535231(VS.85).aspx [4] https://bugzilla.mozilla.org/show_bug.cgi?id=385260#c4 Reproducible: Always
Comment 1•14 years ago
|
||
So is this a request to be able to get computed style, or to get "stale" style? Those seem like pretty separate issues.
Reporter | ||
Comment 2•14 years ago
|
||
I see your point. I don't think we would know which to use unless we had both available, so ideally, both options: getRealComputedStyle and an IE compat object currentStyle.
Comment 3•14 years ago
|
||
You might also want to check with Anne <annevk@opera.com> and look at <http://dev.w3.org/csswg/cssom/>. That seems to have a currentStyle property, but doesn't define it in enough detail to decide whether it's IE compat or not. Getting Anne to specify this stuff seems like a good approach. ;)
Reporter | ||
Comment 4•14 years ago
|
||
If the currentStyle name is to be used in a spec, then it should not attempt to be compat with MS if there are differences, but use the spec (obviously). It *seems* to be just a way to get the real computed style (likely since getComputedStyle has some history and compat issues of its own). But I will ask...
Comment 5•14 years ago
|
||
Adding an API to get "stale computed style" would prevent us from optimizing layout in the future. I don't think we should do that. On the other hand, I've LOVE to have an API to get "specified style", taking all stylesheets into account, but not layout. When I'm trying to make a reduced testcase for a CSS-heavy page, being able to pull all styling inline would be extremely useful.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Need a method to get (real) computed style → Need a method to get "specified style" (faster than and different from "computed style")
Comment 6•14 years ago
|
||
> would prevent us from optimizing layout in the future How so? > On the other hand, I've LOVE to have an API to get "specified style" Just as a note, this would almost certainly be slower than getting computed style in most cases as things stand (we cache computed styles but not specified ones... so far).
Comment 7•14 years ago
|
||
If we had a "stale computed style" API, we'd have to keep around the stale values until the next time you force relayout. Or something.
Comment 8•14 years ago
|
||
"stale" just means "whatever you have around", I'd think.
Reporter | ||
Comment 9•14 years ago
|
||
I haven't heard back from Anne at Opera. I did notice that Opera 10.10 does have currentStyle, but I don't know the particulars on how it is done, or what it really returns (and can't find a doc for it on their site either).
Comment 10•14 years ago
|
||
Any discussion on new APIs is best had on www-style. currentStyle in CSSOM is currently just mentioned as an idea. I'm currently in the process of figuring out all the details that DOM Level 2 Style left out (and there are plenty :/) before starting on new APIs. (As far as Opera goes it is pretty close to getComputedStyle with a few specific differences that I do not know by heart, but e.g. sometimes color keywords are returned rather than completely normalized away.)
QA Contact: general → style-system
Comment 12•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•