-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub: "Error: A custom element with name 'toggle-switch' has already been defined." #46
Comments
customElements.define = function (name, cls) {
-- asNames.add(name);
cls.prototype.addEventListener = addCEEventListener;
cls.prototype.removeEventListener = removeCEEventListener;
++ if (asNames.has(name)) return;
++ asNames.add(name);
oldCED.call(customElements, name, cls);
}; |
Thanks @SeaHOH 👍 ; your suggested patch (in file --- polyfills.js.OLD 2022-09-07 23:00:16.000000000 +0300
+++ polyfills.js.NEW 2022-09-13 17:53:07.303486000 +0300
@@ -406,9 +406,10 @@
rel.call(target, type, listener, options);
}
customElements.define = function (name, cls) {
- asNames.add(name);
cls.prototype.addEventListener = addCEEventListener;
cls.prototype.removeEventListener = removeCEEventListener;
+ if (asNames.has(name)) return;
+ asNames.add(name);
oldCED.call(customElements, name, cls);
};
} |
Very busy with work currently, work here will be slow for the forseeable future. Can someone check the specification what the correct behavior should be? Obviously that patch suppresses the errors, but doing that when the original (or polyfill) actively throws seems wrong to me. Maybe something was changed and it isn't an error anymore, so frameworks just do it? |
So it was a standards issue, but in a different way than I expected. The official polyfill throws errors as instances of the JS I'm fixing that on the |
Browser: Serpent 52.9.0 (2022-08-05) (32-bit)
Extension version: Latest master HEAD (
palefill-v1.20-2-git-20220907-g5c251f5
)Description
Over the last few days, when browsing any GitHub page, I couldn't help noticing the below Web Console error:
The error is generated by GH script:
https://github.githubassets.com/assets/compat-838cedbb.js
Screengrab attached:
Is this something to worry about?
Can it be eliminated?
Thanks for your stupendous, hard, work! 👍
The text was updated successfully, but these errors were encountered: