use native getComputedStyle on IE9 and IE10 #2419

wants to merge 1 commit into


None yet

2 participants


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
@@ -32,6 +32,19 @@ var returnsBordersInWrongOrder = != border;
el = null;
+var hasGetComputedStyle = !!window.getComputedStyle,
+ brokenGetComputedStyle; // Opera rounds sub-pixel values
+if (hasGetComputedStyle){
+ var el = document.createElement('div');
+ = 'none';
+ = '1.5px';
+ document.html.appendChild(el);
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.

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

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