Skip to content

Commit

Permalink
Merge pull request #57 from dillonlucente/uglify-fix
Browse files Browse the repository at this point in the history
Use user agent sniffing to detect IE9 - #43, #40
  • Loading branch information
rodneyrehm committed Jul 15, 2015
2 parents 28579c8 + f8cb7e4 commit 3eb1c41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 36 deletions.
21 changes: 4 additions & 17 deletions viewport-units-buggyfill.hacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,16 @@
var calcExpression = /calc\(/g;
var quoteExpression = /[\"\']/g;
var urlExpression = /url\([^\)]*\)/g;
var isBuggyIE = false;
var isOldIE = false;
var userAgent = window.navigator.userAgent;
var isBuggyIE = /MSIE [0-9]\./i.test(userAgent);
var isOldIE = /MSIE [0-8]\./i.test(userAgent);
var supportsVminmax = true;
var supportsVminmaxCalc = true;

// WARNING!
// Do not remove the following conditional comment.
// It is required to identify the current version of IE

/*@cc_on
@if (9 <= @_jscript_version && @_jscript_version <= 10)
isBuggyIE = true;
if (isBuggyIE === true) {
supportsVminmaxCalc = false;
supportsVminmax = false;
@end
@if (@_jscript_version < 9) {
isOldIE = true;
}
@end
@*/

// iOS SAFARI, IE9, or Stock Android: abuse "content" if "viewport-units-buggyfill" specified
function checkHacks(declarations, rule, name, value) {
Expand Down
21 changes: 2 additions & 19 deletions viewport-units-buggyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
var dimensions;
var declarations;
var styleNode;
var isBuggyIE = false;
var isOldIE = false;
var isBuggyIE = /MSIE [0-9]\./i.test(userAgent);
var isOldIE = /MSIE [0-8]\./i.test(userAgent);
var isOperaMini = userAgent.indexOf('Opera Mini') > -1;

var isMobileSafari = /(iPhone|iPod|iPad).+AppleWebKit/i.test(userAgent) && (function() {
Expand Down Expand Up @@ -66,23 +66,6 @@
return versionNumber <= 4.4;
})();

// Do not remove the following comment!
// It is a conditional comment used to
// identify old Internet Explorer versions

/*@cc_on
@if (9 <= @_jscript_version && @_jscript_version <= 10)
isBuggyIE = true;
@end
@if (@_jscript_version < 9) {
isOldIE = true;
}
@end
@*/

// added check for IE11, since it *still* doesn't understand vmax!!!
if (!isBuggyIE) {
isBuggyIE = !!navigator.userAgent.match(/Trident.*rv[ :]*11\./);
Expand Down

0 comments on commit 3eb1c41

Please sign in to comment.