Skip to content
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

Fix element not calling attach internals #130

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

christophe-g
Copy link

Fix #127

The regression test does not pass on webkit without the fix

test/FormElements.test.ts Outdated Show resolved Hide resolved
@christophe-g christophe-g force-pushed the fix-element-not-calling-attach-internals branch 2 times, most recently from 906d195 to df3a298 Compare May 24, 2024 17:43
@calebdwilliams
Copy link
Owner

Let’s rebase this and I’ll get it reviewed/merged. Appreciate the contribution @christophe-g and the feedback in the PR @asyncLiz.

@christophe-g christophe-g force-pushed the fix-element-not-calling-attach-internals branch from 4441adb to 96428e8 Compare May 26, 2024 13:26
@christophe-g
Copy link
Author

@calebdwilliams - rebased against latest commit.

@@ -393,9 +393,6 @@ export function forceElementInternalsPolyfill(forceCustomStateSet = true) {
} else if (this.tagName.indexOf('-') === -1) {
throw new Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);
}
if (internalsMap.has(this)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the right fix. This is removing a guard against attaching a second internals instance. I think a better fix would be to not call upgrade internals if an instance it doesn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

polyfill not robust for elements that do not call attachInternals (e.g. -buttons)
3 participants