Skip to content

Commit

Permalink
Fix IE11 sniffing. Fixes #17311.
Browse files Browse the repository at this point in the history
  • Loading branch information
mahays0 committed Aug 5, 2013
1 parent ded3e6d commit f58c0e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
29 changes: 17 additions & 12 deletions sniff.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,15 @@ define(["./has"], function(has){
has.add("opera", tv >= 9.8 ? parseFloat(dua.split("Version/")[1]) || tv : tv);
}

// Mozilla and firefox
if(dua.indexOf("Gecko") >= 0 && !has("khtml") && !has("webkit")){
has.add("mozilla", tv);
}
if(has("mozilla")){
//We really need to get away from this. Consider a sane isGecko approach for the future.
has.add("ff", parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1]) || undefined);
}

// IE
var isIE = 0;
if(document.all && !has("opera")){
var isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;

// IE < 11
isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
}else if(dav.indexOf("Trident")){
// IE >= 9
isIE = parseFloat(dav.split("rv:")[1]) || undefined;
}
if(isIE){
//In cases where the page has an HTTP header or META tag with
//X-UA-Compatible, then it is in emulation mode.
//Make sure isIE reflects the desired version.
Expand All @@ -70,6 +66,15 @@ define(["./has"], function(has){

has.add("ie", isIE);
}

// Mozilla and firefox
if(!has("ie") && dua.indexOf("Gecko") >= 0 && !has("khtml") && !has("webkit")){
has.add("mozilla", tv);
}
if(has("mozilla")){
//We really need to get away from this. Consider a sane isGecko approach for the future.
has.add("ff", parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1]) || undefined);
}

// Wii
has.add("wii", typeof opera != "undefined" && opera.wiiremote);
Expand Down
2 changes: 1 addition & 1 deletion window.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ define(["./_base/lang", "./sniff", "./_base/window", "./dom", "./dom-geometry",
// reference to the real window object (maybe a copy), so we must fix it as well
// We use IE specific execScript to attach the real window reference to
// document._parentWindow for later use
if(has("ie") && window !== document.parentWindow){
if(has("ie") < 9 && window !== document.parentWindow){
/*
In IE 6, only the variable "window" can be used to connect events (others
may be only copies).
Expand Down

0 comments on commit f58c0e1

Please sign in to comment.