diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-05-04 08:53:38 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-05-04 08:53:38 +0000 |
commit | 2fdf5dd7e6d627c90f6941e5d5fd31d1f8e4a27e (patch) | |
tree | 9e82ba24f055515b11eac2b60bda781b5be251ee /src/com/itmill | |
parent | 47f23b42f204b28b64bb4cad90927dfcb4dfefd7 (diff) | |
download | vaadin-framework-2fdf5dd7e6d627c90f6941e5d5fd31d1f8e4a27e.tar.gz vaadin-framework-2fdf5dd7e6d627c90f6941e5d5fd31d1f8e4a27e.zip |
Improved IE8 mode detection. IE8 is now detected as either IE7 (if in compatibility mode) or IE8 and the CSS classes are set accordingly (#2879).
svn changeset:7607/svn branch:6.0
Diffstat (limited to 'src/com/itmill')
-rw-r--r-- | src/com/itmill/toolkit/terminal/gwt/client/BrowserInfo.java | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/BrowserInfo.java b/src/com/itmill/toolkit/terminal/gwt/client/BrowserInfo.java index 42e44d0374..1604ac65d1 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/BrowserInfo.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/BrowserInfo.java @@ -74,6 +74,11 @@ public class BrowserInfo { ieVersionString = ieVersionString.substring(0, ieVersionString .indexOf(";")); version = Float.parseFloat(ieVersionString); + + if (version == 8 && isIE8InIE7CompatibilityMode()) { + version = 7; + } + } } catch (Exception e) { ClientExceptionHandler.displayError(e); @@ -100,7 +105,6 @@ public class BrowserInfo { */ public String getCSSClass() { String prefix = "i-"; - boolean ie8 = false; if (cssClass == null) { String bs = getBrowserString().toLowerCase(); @@ -122,29 +126,32 @@ public class BrowserInfo { b = "ie"; int i = bs.indexOf(" msie ") + 6; String ieVersion = bs.substring(i, i + 1); - v = b + ieVersion; - // This adds .i-ie7 for ie8 also. - // TODO Remove this when IE8 is no longer run in compatibility - // mode - if (ieVersion != null && ieVersion.equals("8")) { - ie8 = true; + if (ieVersion != null && ieVersion.equals("8") + && isIE8InIE7CompatibilityMode()) { + ieVersion = "7"; } + v = b + ieVersion; } else if (bs.indexOf("opera/") != -1) { b = "op"; int i = bs.indexOf("opera/") + 6; v = b + bs.substring(i, i + 3).replace(".", ""); } cssClass = prefix + b + " " + prefix + v; - if (ie8) { - cssClass += " " + prefix + "ie7"; - } } return cssClass; } + private native boolean isIE8InIE7CompatibilityMode() + /*-{ + var mode = $wnd.document.documentMode; + if (!mode) + return false; + return (mode == 7); + }-*/; + public boolean isIE() { return isIE; } @@ -161,6 +168,10 @@ public class BrowserInfo { return isIE && version == 7; } + public boolean isIE8() { + return isIE && version == 8; + } + public boolean isGecko() { return isGecko; } @@ -201,6 +212,7 @@ public class BrowserInfo { c.log("isIE() " + get().isIE()); c.log("isIE6() " + get().isIE6()); c.log("isIE7() " + get().isIE7()); + c.log("isIE8() " + get().isIE8()); c.log("isFF2() " + get().isFF2()); c.log("isSafari() " + get().isSafari()); c.log("getGeckoVersion() " + get().getGeckoVersion()); |