When using Snabbdom attrs to set HTML element attributes, values which are objects are now automatically serialized to JSON. Previously, since HTML attributes are always strings, trying to set a raw object value with setAttribute()
resulted in the attribute value [object Object]
.
For example, in
div(attrs={foo: {hello: 'world'}})
the foo
attr will end up in HTML as JSON: "{"hello":"world"}"
.
This behavior can be controlled with the serializeAttrsObjects
option, which defaults to true
when using Snabbdom.