Add document.registerElement polyfill

Atom is upgrading to use electron 11.4.7 however on that version
chromium has deprecated `document.registerElement`.

There are some community packages whose implementations depend on
`document.registerElement`. Therefore shipping without a polyfill will
break those packages.

As Atom maintainers we wouldn't want to introduce a change
that has the potential of breaking many packages.
This commit is contained in:
sadick254 2021-08-25 21:59:43 +03:00
parent be5aa06bc9
commit 04d6338c70
No known key found for this signature in database
GPG Key ID: FB51CF448C1FD089
1 changed files with 13 additions and 0 deletions

View File

@ -151,6 +151,19 @@
)
: require('document-register-element');
const Grim = useSnapshot
? snapshotResult.customRequire('../node_modules/grim/lib/grim.js')
: require('grim');
const documentRegisterElement = document.registerElement;
document.registerElement = (type, options) => {
Grim.deprecate(
'Use `customElements.define` instead of `document.registerElement` see https://javascript.info/custom-elements'
);
return documentRegisterElement(type, options);
};
const { userSettings, appVersion } = getWindowLoadSettings();
const uploadToServer =
userSettings &&