use native getComputedStyle on IE9 and IE10 #2419

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

Contributor

this is a robustness enhancement as discussed on #2414 (comment)

This relegates the use of non-standard currentStyle to oldIE and Opera (which has a bug where sub-pixel values get rounded on native getComputedStyle, which can create jerky animations)

As you see this also finally kills the usage of browser.* sniffs on getStyle

@gonchuki gonchuki commented on the diff Aug 29, 2012
Source/Element/Element.Style.js
@@ -32,6 +32,19 @@ var returnsBordersInWrongOrder = el.style.border != border;
el = null;
//</ltIE9>
+var hasGetComputedStyle = !!window.getComputedStyle,
+ brokenGetComputedStyle; // Opera rounds sub-pixel values
+
+if (hasGetComputedStyle){
+ var el = document.createElement('div');
+ el.style.display = 'none';
+ el.style.paddingLeft = '1.5px';
+ document.html.appendChild(el);
gonchuki
gonchuki Aug 29, 2012 Contributor

appending this here as the body might not exist yet at this point of the code execution (if js was included in head) and Opera returns empty values for window.getComputedStyle on a detached node.

Owner
arian commented Sep 5, 2012

Looks good.

@arian arian closed this in 5812b7d Feb 11, 2013
@gonchuki gonchuki referenced this pull request in mootools/mootools-more Feb 11, 2014
Closed

document.body.mask() no longer blocks with IE11 #1222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment