Previously the style attribute was directly being set as string, which is the intended behavior if style was an ordinary attribute. But it's not. Internally it has its own data structure CSSStyleDeclaration. More discussion on this here https://github.com/intercellular/cell/issues/136
Solution
The solution:
supports an object notation (in addition to the string format) for setting the style.
overrides the getter so that even if the attribute was set as a string it can be retrieved as CSSStyleDeclaration object.
This PR adds support for CSSStyleDeclaration type style.
Problem
Previously the
style
attribute was directly being set as string, which is the intended behavior ifstyle
was an ordinary attribute. But it's not. Internally it has its own data structure CSSStyleDeclaration. More discussion on this here https://github.com/intercellular/cell/issues/136Solution
The solution:
CSSStyleDeclaration
object.Example:
This is same as using the string format:
Also it can be modified:
You can play with the fiddle here: https://jsfiddle.net/1y8xfL7j/