-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added 'ie' class for Internet Explorer 10 and 11 #1506
Conversation
This is added in addition to the 'internet explorer' class.
src/core/js/device.js
Outdated
var browserString = (Adapt.device.browser.toLowerCase() === 'msie') ? 'ie' : Adapt.device.browser.toLowerCase(); | ||
var browser = Adapt.device.browser.toLowerCase(); | ||
// Convert 'msie' to 'ie' for backwards compatibility. | ||
var browserString = (browser === 'msie') ? 'ie' : browser; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var browserString = browser;
switch(browserString) {
case "msie": case "internet explorer":
browserString += " ie";
}
or
var browserString = browser.replace(/^msie$|^internet explorer$/, browser + " ie" );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't the switch
statement also add the msie
class though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var browserString = browser;
switch(browserString) {
case "msie": case "internet explorer":
browserString = "ie";
}
or
var browserString = browser.replace(/^msie$|^internet explorer$/, "ie" );
As per tom's latest suggestion on the original issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, apologies, I missed Tom's comment about disregarding the internet explorer
class.
Following PR it was agreed to drop the 'internet explorer' class, as this was a bug introduced in previous re-work to device.js.
src/core/js/device.js
Outdated
var browserString = (Adapt.device.browser.toLowerCase() === 'msie') ? 'ie' : Adapt.device.browser.toLowerCase(); | ||
var browser = Adapt.device.browser.toLowerCase(); | ||
// Convert 'msie' and 'internet explorer' to 'ie'. | ||
var browserString = browser.replace(/^msie$|^internet explorer$/, 'ie'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we perhaps lose the string boundary tokens? I personally find it more readable without and less need to refer back to a regex reference.
var browserString = browser.replace(/msie|internet explorer/, 'ie');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm alright with that. They aren't needed, more implied by circumstance.
This is added in addition to the 'internet explorer' class.