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

Limit side effects of polyfills loaded for config/I18n #2907

Closed
1 task
romaricpascal opened this issue Oct 10, 2022 · 0 comments · Fixed by #2959
Closed
1 task

Limit side effects of polyfills loaded for config/I18n #2907

romaricpascal opened this issue Oct 10, 2022 · 0 comments · Fixed by #2959
Assignees
Milestone

Comments

@romaricpascal
Copy link
Member

What

Ensure only components needing the dataset, closest and possibly trim polyfills import them. This'll help reduce bundle size for non-configurable or non-internationalisable components.

Possible approach could be to:

  • make a separate module for closestAttributeValue that imports Element.prototype.closest
  • make a separate module for normaliseString that imports String.prototype.trim
  • import Element.prototype.dataset in all components requiring configuration as they access the dataset. Given that one will be an easy one to miss, I wonder if we shouldn't have a getDataset function that has side effect.

These files could live in an src/polyfilled folder that we'll revisit for v5.

Why

@colinrotherham wrote a neat explanation in this comment: #2887 (comment)

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • Polyfills don't burden components that don't require them when the components are imported individually
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

3 participants