- From: Garrett Smith <dhtmlkitchen@gmail.com>
- Date: Tue, 22 Sep 2009 08:40:55 -0700
- To: Travis Leithead <travil@microsoft.com>
- Cc: www-style CSS <www-style@w3.org>, Sylvain Galineau <sylvaing@microsoft.com>, Sharon Cohen <sharco@microsoft.com>
On Tue, Sep 22, 2009 at 7:07 AM, Travis Leithead <travil@microsoft.com> wrote: > We (the IE team) are _considering_ dropping support for currentStyle and > runtimeStyle in our next most "standards compliant" mode. However, because > there is interest in this space (via the CSSOM spec [1], we wanted to get a > feel for whether other browsers are considering implementing these APIs or > not. (We see that Opera has an implementation.) > [...] > > > _IF_ we are to drop support for these, we'd want to provide a more > "standards compliant" replacement, for which: > > runtimeStyle -> getOverrideStyle > > currentStyle -> ?? > > > > Given existing API design precedent, it seems logical to create a > "getCascadedStyle" API that would replace "currentStyle" in the future--it > can handle pseudo-elements and would be similar to related style APIs of > which web developers are already familiar. > document.defaultView.getCascadedStyle? As in: http://lists.w3.org/Archives/Public/www-dom/2000AprJun/0112.html ? > > > Any strong opinions on this matter? > A strong opinion can be formed by making observations. Using google code search to find existing code can reveal usage patterns. When analyzing existing code, one can formally or informally write a program with the new feature. Often it is obvious just from looking at the code. Dropping support for currentStyle and runtimeStyle would break Microsoft-only sites and applications. Gecko, Webkit, Opera, IE all have no implementation of document.defaultView.getCascadedStyle. It would just make more work for all involved. Those involved included: Microsoft, for working to implement getCascadedStyle, Microsoft's business customers, for having to update their code, the w3c (who would presumably write up a spec), and the rest of the web, . Consider how existing code that uses currentStyle (only) would have to change to still try to function:- var value = ""; if(document.defaultView) { /// this fails in IE9 and Safari 1 (Safari 1 had a broken implementation). value = document.defaultView.getComputedStyle(el, "").height; } else if(el.currentStyle) { value = el.currentStyle.height; } } to:- var value = ""; if(document.defaultView) { if(document.defaultView.getComputedStyle) { value = document.defaultView.getComputedStyle(el, "").height; } else if(document.defaultView.getCascadedStyle) { value = document.defaultView.getCascadedStyle(el, "").height; } else if(el.currentStyle) { value = el.currentStyle.height; } } Benefits: Officially part of a new standard. Drawbacks: Breaks many sites in ways that probably cannot be easily fixed. Makes developing cross-browser applications a lot more work. Dropping both runtimeStyle would make it harder for code that attempts to make conversion between em|ex|pt|in| to px. Garrett
Received on Tuesday, 22 September 2009 15:41:35 UTC