Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Add document.registerElement polyfill
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sadick254 committed Aug 26, 2021
1 parent be5aa06 commit 04d6338
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 04d6338

Please sign in to comment.