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

element style attribute assignment #12

Closed
stutteringp0et opened this issue Jun 15, 2018 · 2 comments
Closed

element style attribute assignment #12

stutteringp0et opened this issue Jun 15, 2018 · 2 comments

Comments

@stutteringp0et
Copy link

Any plans to support element level value assignment via the style tag?

<h1 style="--h1-color:blue">this would be super nice</h1>
@jhildenbiddle
Copy link
Owner

It could be done, but not in the way your example suggests.

The ponyfill only supports :root-level declarations, but your example declares a custom property scoped to the <h1> tag (and all of its children). This won't be supported because it is not possible do so in a spec-compliant way (see #5 for details).

What could be added is the ability to transform inline custom property values to static values. For example:

:root {
  --h1-color: blue;
}
<!-- Before -->
<h1 style="color: var(--h1-color)">this would be super nice</h1>

<!-- After with options.preserve: false (default)-->
<h1 style="color: blue;">this would be super nice</h1>

<!-- After with options.preserve: true -->
<h1 style="color: var(--h1-color); color: blue;">this would be super nice</h1>

I'm not sure if this addresses your needs though.

@stutteringp0et
Copy link
Author

I was looking for feature parity with browsers. Chrome, FF, Opera, Safari, Edge all support this. I'm looking at this for IE11 only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants