getmdl-select icon indicating copy to clipboard operation
getmdl-select copied to clipboard

IE 11 Compatibility

Open jtitley opened this issue 8 years ago • 5 comments

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

jtitley avatar Jan 24 '18 02:01 jtitley

@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.

munavvard2 avatar Apr 24 '18 10:04 munavvard2

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 avatar Apr 30 '18 05:04 jtitley

@jtitley Thanks , i used that working fine.

munavvard2 avatar Apr 30 '18 10:04 munavvard2

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

alexbananabob avatar Jun 01 '18 13:06 alexbananabob

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

jagadeeshagm avatar Feb 08 '19 08:02 jagadeeshagm