WebReflection / document-register-element

A stand-alone working lightweight version of the W3C Custom Elements specification
ISC License
1.13k stars 116 forks source link

Polyfill does not seem to be working in IE 11 #182

Closed redfellow closed 4 years ago

redfellow commented 4 years ago

I have this in my <head>:

<script>this.customElements||document.write('<script src="//unpkg.com/document-register-element"><\x2fscript>');</script>
<script src="//unpkg.com/@ungap/custom-elements-builtin"></script>

Yet attempting to extend a class in IE11 (which I'm attempting to customElement.define afterwards) fails. At this point I expect to be understanding something very wrong, so any input would be greatly appreciated.

image

WebReflection commented 4 years ago

IE11 doesn't support class, you need Babel to transpile your code.

redfellow commented 4 years ago

Oh, never ventured there since I've been only coding in vanilla for years. I'll look into how to do that, or if possible, code directly in a supported syntax/format.

Thank you.

WebReflection commented 4 years ago

or if possible, code directly in a supported syntax/format.

you don't want to do that ... use babel to transpile your code 😉

redfellow commented 4 years ago

Let's just say that I'm working with somewhat perverted legacy in-house framework that's been built for the past 20 years.

I don't know much 'bout Babel, but it's very difficult to get any preprocessors in there. 😓 But I'm gonna look into it on monday and see what's what.

WebReflection commented 4 years ago

If you can't get any preprocessor in there, you can forget about class, or anything related to modern JavaScript, as nothing will work in your target browsers ... or ... you use babel for the newer code you're writing

WebReflection commented 4 years ago

to expand, there's literally nothing I can do in here to make class or anything modern work in IE11, so this is your only chance https://babeljs.io/