Skip to content

Commit

Permalink
Change "HTML5 not supported" conditions to exclude IE8 *and lower*, i…
Browse files Browse the repository at this point in the history
…nstead of just IE8.

(And similarly for other browsers, for the sake of consistency.)
This makes sure the tests are excluded even in compatibility mode, where IE8 advertises itself as IE7, but still exposes APIs for certain features, even though those features are broken, because ... IE8, ladies and gentlemen.
On behalf of juangj.
  • Loading branch information
sevaseva committed Sep 12, 2014
1 parent 6a34eac commit b1a6a33
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions javascript/atoms/html5/html5_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,30 @@ bot.html5.API = {


/**
* True if the current browser is IE8.
* True if the current browser is IE version 8 or earlier.
* @private {boolean}
* @const
*/
bot.html5.IS_IE8_ = goog.userAgent.IE &&
bot.userAgent.isEngineVersion(8) && !bot.userAgent.isEngineVersion(9);
bot.html5.IS_IE8_OR_EARLIER_ = goog.userAgent.IE &&
!bot.userAgent.isEngineVersion(9);


/**
* True if the current browser is Safari 4.
* True if the current browser is Safari version 4 or earlier.
* @private {boolean}
* @const
*/
bot.html5.IS_SAFARI4_ = goog.userAgent.product.SAFARI &&
bot.userAgent.isProductVersion(4) && !bot.userAgent.isProductVersion(5);
bot.html5.IS_SAFARI4_OR_EARLIER_ = goog.userAgent.product.SAFARI &&
!bot.userAgent.isProductVersion(5);


/**
* True if the browser is Android 2.2 (Froyo).
* True if the browser is Android version 2.2 (Froyo) or earlier.
* @private {boolean}
* @const
*/
bot.html5.IS_ANDROID_FROYO_ = goog.userAgent.product.ANDROID &&
bot.userAgent.isProductVersion(2.2) && !bot.userAgent.isProductVersion(2.3);
bot.html5.IS_ANDROID_FROYO_OR_EARLIER_ = goog.userAgent.product.ANDROID &&
!bot.userAgent.isProductVersion(2.3);


/**
Expand Down Expand Up @@ -98,7 +98,7 @@ bot.html5.isSupported = function(api, opt_window) {
switch (api) {
case bot.html5.API.APPCACHE:
// IE8 does not support application cache, though the APIs exist.
if (bot.html5.IS_IE8_) {
if (bot.html5.IS_IE8_OR_EARLIER_) {
return false;
}
return goog.isDefAndNotNull(win.applicationCache);
Expand All @@ -109,11 +109,11 @@ bot.html5.isSupported = function(api, opt_window) {

case bot.html5.API.DATABASE:
// Safari4 database API does not allow writes.
if (bot.html5.IS_SAFARI4_) {
if (bot.html5.IS_SAFARI4_OR_EARLIER_) {
return false;
}
// Android Froyo does not support database, though the APIs exist.
if (bot.html5.IS_ANDROID_FROYO_) {
if (bot.html5.IS_ANDROID_FROYO_OR_EARLIER_) {
return false;
}
return goog.isDefAndNotNull(win.openDatabase);
Expand All @@ -129,14 +129,14 @@ bot.html5.isSupported = function(api, opt_window) {

case bot.html5.API.LOCAL_STORAGE:
// IE8 does not support local storage, though the APIs exist.
if (bot.html5.IS_IE8_) {
if (bot.html5.IS_IE8_OR_EARLIER_) {
return false;
}
return goog.isDefAndNotNull(win.localStorage);

case bot.html5.API.SESSION_STORAGE:
// IE8 does not support session storage, though the APIs exist.
if (bot.html5.IS_IE8_) {
if (bot.html5.IS_IE8_OR_EARLIER_) {
return false;
}
return goog.isDefAndNotNull(win.sessionStorage) &&
Expand Down

0 comments on commit b1a6a33

Please sign in to comment.