Skip to content

Commit

Permalink
Merge pull request #290 from oddbird/inline-styles
Browse files Browse the repository at this point in the history
Document inline style limitation
  • Loading branch information
jamesnw authored Feb 5, 2025
2 parents 90e449c + 514d658 commit 7f7006d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,22 @@ following features:
In addition, JS APIs like `CSSPositionTryRule` or `CSS.supports` will not be
polyfilled.

### Inline styles

Browsers provide some validation for imperatively setting inline styles.
`el.style.color = "foo"` and `el.style.foo = "bar"` do not change the inline
styles of `el`. This is problematic for this polyfill, as we would like to
support `el.style.anchorName = "--foo"`, but that won't work in browsers that
don't support the `anchor-name` property.

While `el.setAttribute('style', 'anchor-name: --foo')` or `<div
style="anchor-name: --foo" />` both work, developers are often using tools that
generate the DOM. Both React and Vue use methods that remove the unknown inline
style properties at runtime.

If you are using inline styles to set anchor-related properties and the polyfill
isn't working, verify that the inline styles are actually showing up in the DOM.

## Sponsor OddBird's OSS Work

At OddBird, we love contributing to the languages & tools developers rely on.
Expand Down

0 comments on commit 7f7006d

Please sign in to comment.