Houdini typed values API can be polyfilled with a fallback to strings, so we can actually start using in the latest versions and get perf benefits.
https://ishoudinireadyyet.com/
https://developers.google.com/web/updates/2018/03/cssom
Current way:
rule.style.margin = '5px';
rule.style.margin // 5px
New way:
rule.attributeStyleMap.set('margin', CSS.px(10))
rule.attributeStyleMap.get('margin') // CSSUnitValue {value: 10, unit: 'px'}
We can easily feature test it and use the new API always when supported. We don't care about all the CSS.whatever methods, they should be polyfilled in a separate product, we should just use attributeStyleMap when available, it also supports old-style strings.
Todo
Houdini typed values API can be polyfilled with a fallback to strings, so we can actually start using in the latest versions and get perf benefits.
https://ishoudinireadyyet.com/
https://developers.google.com/web/updates/2018/03/cssom
Current way:
New way:
We can easily feature test it and use the new API always when supported. We don't care about all the CSS.whatever methods, they should be polyfilled in a separate product, we should just use
attributeStyleMapwhen available, it also supports old-style strings.Todo