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

IE 11 Compatibility #74

Open
jtitley opened this issue Jan 24, 2018 · 5 comments
Open

IE 11 Compatibility #74

jtitley opened this issue Jan 24, 2018 · 5 comments
Labels
to implement implement in the next release

Comments

@jtitley
Copy link

jtitley commented Jan 24, 2018

May I suggest some changes to support IE 11? I was finally able to achieve it and have all functionality working with the following changes. Since you know the code I think you can avoid this complex fix by avoiding some incompatible functions like ForEach and new Event.

In getmdl-select.js add the following function to replace new Event()
// For IE Compatibility
// source: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
function CustomEvent(event, params) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
}

Where you use new Event, do the following:

var event;
try { event = new Event('closeSelect');} catch(err) {}
if (event == undefined) {
event = window.CustomEvent('closeSelect');
}

To support NodeList ForEach I added this in whenLoaded()
// source: https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}

@munavvard2
Copy link

@jtitley , can you instruct me where the code to put? or can you give me changed file so that i can use into my project, btw thanks for your work.

@jtitley
Copy link
Author

jtitley commented Apr 30, 2018

I've forked a copy here: Just copy getdtl-select.js

I'll leave it up to the owner to determine if this gets folded into this version.

I don't quite understand how the author generated the .min versions so I've left them alone.

@munavvard2
Copy link

@jtitley Thanks , i used that working fine.

@alexbananabob
Copy link
Collaborator

@jtitley, great work! Many thanks
We will try to include you code in the next release

@alexbananabob alexbananabob added the to implement implement in the next release label Jun 1, 2018
@jagadeeshagm
Copy link

I've forked a copy here: Just copy getdtl-select.js

I'll leave it up to the owner to determine if this gets folded into this version.

I don't quite understand how the author generated the .min versions so I've left them alone.

@jtitley - I am facing the foreach issue when i used the getdtl-select.js in IE11(EDGE). What is the alternate solutions

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

No branches or pull requests

4 participants