Skip to content
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

Merged
merged 3 commits into from
Apr 6, 2017
Merged

Conversation

brian-learningpool
Copy link
Member

This is added in addition to the 'internet explorer' class.

This is added in addition to the 'internet explorer' class.
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;
Copy link
Member

@oliverfoster oliverfoster Apr 5, 2017

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" );

Copy link
Member Author

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?

Copy link
Member

@oliverfoster oliverfoster Apr 5, 2017

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.

Copy link
Member Author

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.
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');
Copy link
Contributor

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');

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants