-
Notifications
You must be signed in to change notification settings - Fork 41
Description
You know how you can use Html.Attributes.class
multiple times to stack them? Like [ Html.Attributes.class "one", Html.Attribute.class "two" ]
results in class="one two"
. That’s actually not an elm/html feature, it’s an elm/virtual-dom feature. It’s implemented for both the className
property and the the class
attribute, even though Html.Attributes.class is currently implemented only using the className
property.
In other words, VirtualDom.property "className" (Json.Encode.string "my-class")
and VirtualDom.attribute "class" "my-class"
are equal citizens. Except in elm-explorations/test. Query.has [ Selector.class "my-class" ]
only works if the class was set using className
. Which it is 99.99 % of the time since Html.Attributes.class
is implemented using className
.
So to follow elm/virtual-dom’s lead, elm-explorations/test should do the same.
I also changed Html.Attributes.class
to use the class
attribute in elm/html#259. A user of my forked packages let me know that their tests stopped passing when they started using my forks. That led me to implement the following workaround to stay backwards compatible:
(That link also explains why I switched from className
to class
.) So that’s also a reason to do this.