lib/generators/templates/vendor/assets/javascripts/polyfills/selectivizr.js in rail_pass-0.1.4 vs lib/generators/templates/vendor/assets/javascripts/polyfills/selectivizr.js in rail_pass-0.1.5

- old
+ new

@@ -24,21 +24,24 @@ */ (function(win) { - // If browser isn't IE, then stop execution! This handles the script - // being loaded by non IE browsers because the developer didn't use - // conditional comments. - if (/*@cc_on!@*/true) return; + // Determine IE version and stop execution if browser isn't IE. This + // handles the script being loaded by non IE browsers because the + // developer didn't use conditional comments. + var ieUserAgent = navigator.userAgent.match(/MSIE (\d+)/); + if (!ieUserAgent) { + return false; + } // =========================== Init Objects ============================ var doc = document; var root = doc.documentElement; var xhr = getXHRObject(); - var ieVersion = /MSIE (\d+)/.exec(navigator.userAgent)[1]; - + var ieVersion = ieUserAgent[1]; + // If were not in standards mode, IE is too old / new or we can't create // an XMLHttpRequest object then we should get out now. if (doc.compatMode != 'CSS1Compat' || ieVersion<6 || ieVersion>8 || !xhr) { return; }