Skip to content

Updated: "Fix element not calling attach internals"#142

Merged
calebdwilliams merged 11 commits intocalebdwilliams:mainfrom
Cliffback:fix-element-not-calling-attach-internals
Apr 16, 2025
Merged

Updated: "Fix element not calling attach internals"#142
calebdwilliams merged 11 commits intocalebdwilliams:mainfrom
Cliffback:fix-element-not-calling-attach-internals

Conversation

@Cliffback
Copy link
Copy Markdown
Contributor

@Cliffback Cliffback commented Apr 16, 2025

Due to inactivity on #130 that fixes #127, which we need in our project, I forked the original PR and implemented the requested changes, hopefully so that it can get merged soon.

To address @calebdwilliams comment regarding removing the guard against a second instance, this didn't work out for us, as we need the upgradeInternals to be called. I therefore added a flag to prevent the error being thrown if the attach internals function is run in upgradeInternals.

I also fixed some rollup warnings, like circular dependencies, undefined this, and missing name argument.

All credits to @christophe-g for the original implementation. I mean no disrespect by implementing his change, and would be more than happy to close this / change it to only fix the rollup warnings if the original PR gets merged.

christophe-g and others added 8 commits April 15, 2025 15:42
needed to avoid error thrown in cases were internals are attached in the
upgradeInternals function
Circular dependencies
dist/utils.js -> dist/mutation-observers.js -> dist/aom.js -> dist/utils.js
dist/utils.js -> dist/mutation-observers.js -> dist/utils.js
Copy link
Copy Markdown
Owner

@calebdwilliams calebdwilliams left a comment

Choose a reason for hiding this comment

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

A couple small change requests, but overall this looks great!

Also another huge shoutout to @christophe-g. I haven't been the most responsive on my open source stuff lately (trying to protect myself from burn out) so I'm really sorry I didn't get to your PR in time.

Comment thread package.json
Comment thread src/element-internals.ts
Comment thread src/mutation-observers.ts
Comment thread src/utils.ts Outdated
Comment thread test/CustomStateSet.test.ts
Copy link
Copy Markdown
Owner

@calebdwilliams calebdwilliams left a comment

Choose a reason for hiding this comment

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

lgtm; thanks @Cliffback

@calebdwilliams calebdwilliams merged commit 12756b7 into calebdwilliams:main Apr 16, 2025
@calebdwilliams
Copy link
Copy Markdown
Owner

This has been released as element-internals-polyfill@3.0.2

@Cliffback
Copy link
Copy Markdown
Contributor Author

Awesome! Thanks for the quick feedback, approval and release, this is much appreciated!

And thanks to @christophe-g for the original fix!

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