Skip to content

Commit

Permalink
Merge branch 'patch-1' of https://github.com/vclav/flexibility into v…
Browse files Browse the repository at this point in the history
…clav-patch-1
  • Loading branch information
jonathantneal committed Apr 19, 2016
2 parents 64d4667 + 2362a80 commit 264c85a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@ flexibility.detect = function detect() {
}

var node = document.createElement('p');

try {
node.style.display = 'flex';

return node.style.display === 'flex';
} catch (error) {
return false;
}
};

if (!flexibility.detect() && document.attachEvent && document.documentElement.currentStyle) {
if (!flexibility.detect() || ieVersion() <= 9) {
document.attachEvent('onreadystatechange', function () {
flexibility.onresize({
target: document.documentElement
});
});
}

function ieVersion() {
var msiePos;

return (msiePos = navigator.userAgent.indexOf('MSIE')) > -1 ? parseInt(navigator.userAgent.slice(msiePos + 5)) : false;
}

0 comments on commit 264c85a

Please sign in to comment.