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

idea: it might be worth doing a PR to mrhenry/polyfill-library #3

Open
kapouer opened this issue Nov 22, 2024 · 3 comments
Open

idea: it might be worth doing a PR to mrhenry/polyfill-library #3

kapouer opened this issue Nov 22, 2024 · 3 comments

Comments

@kapouer
Copy link
Contributor

kapouer commented Nov 22, 2024

The polyfill-library is a module for building bundles based on feature-detection or user-agent detection.
It has bad reputation because of the polyfill.io security debacle, however it is still very much useful.
The hard part is to correctly define the dependencies of view-transitions-polyfill w.r.t. polyfill-library.
For example, view-transitions-polyfill depends on CustomElement, which is not yet available as a polyfill, so opening a PR there is too early.
Does it depend on other recent DOM/CSS features that might have existing polyfills ?

@demarketed
Copy link
Owner

demarketed commented Nov 22, 2024

Some newer browser features that the polyfill depends on (other than CustomElement) are the Web Animations API (notably Element.animate() and Document.getAnimations()) and requestAnimationFrame().
It uses the new CSS :where() selector, but it is not necessary.
Everything else is just ES6 or common DOM methods.
Technically, the polyfill could be refactored to avoid using custom elements, replacing things like <view-transition> with divs, and the style encapsulation provided by Shadow DOM is not strictly necessary.

@kapouer
Copy link
Contributor Author

kapouer commented Nov 22, 2024

What features it depends on are very interesting informations - it might be worth adding them to this project's README.md.

As you can see here, animate is polyfilled, as well as requestAnimationFrame.
However, getAnimations isn't, as we can see in WebAnimations polyfill project.

At some point it's interesting to see if your providePROJECT can provide a degraded version (or not ?) if getAnimations isn't available.
For CustomElement I started to ask them if they're okay to add it.
For Shadow DOM it's a lost battle. It might be a good idea to try to not depend on it.

@demarketed
Copy link
Owner

demarketed commented Nov 22, 2024

I'll add information on notable features required by the polyfill to the README. Maybe I could start working on a degraded version in a separate branch.

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

No branches or pull requests

2 participants