Closed micahhahn closed 2 years ago
Note: I discovered this when trying to convert some views to use lazy
. Since lazy passes its node immediately to toUnstyled
this was breaking complex styles that came from multiple different css
attributes.
I noticed some strange behavior that I'm pretty sure should be considered a bug.
If I specify multiple
css
attributes on the root node of a DOM tree that will get passed totoUnstyled
then only the last call tocss
gets applied. See the following example:This produces text that is red, but does not have a blue background.
Also it's interesting here that two class names are produced, but only one has any css styles associated with it:
If, however, we apply the
css
attributes to a child node instead of the root we see both styles applied:Which resolution is correct?
There are a couple comments in VirtualDom.Styled.elm that suggest that the overriding behavior is intentional:
However, we seem to rely on being able to apply multiple
css
attributes quite heavily at NoRedInk. This seems to be the more useful behavior.