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:
lydell/virtual-dom@81c070c
(That link also explains why I switched from className to class.) So that’s also a reason to do this.
You know how you can use
Html.Attributes.classmultiple times to stack them? Like[ Html.Attributes.class "one", Html.Attribute.class "two" ]results inclass="one two". That’s actually not an elm/html feature, it’s an elm/virtual-dom feature. It’s implemented for both theclassNameproperty and the theclassattribute, even though Html.Attributes.class is currently implemented only using theclassNameproperty.In other words,
VirtualDom.property "className" (Json.Encode.string "my-class")andVirtualDom.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 usingclassName. Which it is 99.99 % of the time sinceHtml.Attributes.classis implemented usingclassName.So to follow elm/virtual-dom’s lead, elm-explorations/test should do the same.
I also changed
Html.Attributes.classto use theclassattribute 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:lydell/virtual-dom@81c070c
(That link also explains why I switched from
classNametoclass.) So that’s also a reason to do this.