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

elements option should find inline styles on descendent elements #289

Open
jamesnw opened this issue Jan 15, 2025 · 0 comments
Open

elements option should find inline styles on descendent elements #289

jamesnw opened this issue Jan 15, 2025 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jamesnw
Copy link
Contributor

jamesnw commented Jan 15, 2025

Is your feature request related to how this polyfill works? Please describe.

Given this HTML

<div id="wrapper">
  <div id="anchor" style="anchor-name: --a">A</div>
  <div id="target" style="position-anchor: --a">A</div>
</div>

and calling:

polyfill({elements: [wrapper], excludeInlineStyles: true})

Inline styles on #anchor and #target are not polyfilled. It would be useful to not have to pass each individual element, but instead just the wrapper.

Describe the solution you'd like

Adjust the polyfill so that if an element is passed, it AND its entire subtree are evaluated for inline anchor styles.

Describe alternatives you've considered

We could make this opt in, perhaps with a includeChildInlineStyles or an alternate to elements, but I think it's unlikely that people will want to not polyfill children.

Additional context
Codepen Repro

@jamesnw jamesnw added enhancement New feature or request good first issue Good for newcomers labels Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant