-
Notifications
You must be signed in to change notification settings - Fork 11
IE11 Element has no innerHTML descriptor but HTMLElement does #18
Comments
To clarify: this polyfill is for Safari and WebKit browsers only, you can use document-register-element for IE11, but also IE10, or IE9, or even IE8 👋 |
I assumed it was all right to include it in a bundle even if not needed, but i was wrong. |
@kapouer you are not wrong, but you have to include In few words, this polyfill is only for browsers that have Browsers without this polyfill need the old one, and there are ways to not initialize the old one, and yet it should be included if you target IE/Edge. |
Well, i am including document-register-element before this one. |
The issue is that IE should never land in the It throws because it has no |
Actually: if (customElements.get('ungap-li') || typeof Reflect == typeof EXTENDS)
return; IE does never enter in there, if your transpiler breaks the code, I'd ratther file an issue to your transpiler of choice. If you change the source to this code: if (customElements.get('ungap-li') || typeof Reflect == 'undefined')
return; what happens? It's also possible you are using obtrusive polyfills that are incapable of providing real var HtmlLI = HTMLLIElement;
var LI = function () {
return Reflect.construct(HtmlLI, [], LI);
};
LI.prototype = Object.create(HtmlLI.prototype);
customElements.define('ungap-li', LI, desc);
if (!/is="ungap-li"/.test((new LI).outerHTML))
throw desc; But then again, IE should never enter any of this, if TL;DR I think you have a polyfill order issue ... never load my polyfills after others, as mine are tested against non polluted environments, others pretend to patch the un-patchable, and easily break after. |
P.S. if you have |
Actually some transpiler was breaking the code: swc-project/swc#688 ! But i only used it locally for testing, this issue is not about that ;) And yes, i am loading polyfill.io before, so it pulls a Reflect polyfill. |
If you can use polyfill.io then you can use one of these best practices to include this polyfill too: |
So, I've discovered a new trick, that should now work out of the box, even if polyfills io is on top of the page. Please let me know how that goes, thanks. |
With various other es5 polyfills, it's possible to run custom elements on IE11.
However,
I'm not sure it's fixable in a general way (in another polyfill),
it's easier to workaround it here.
The text was updated successfully, but these errors were encountered: