When you assign to innerHTML , the browser will normalize the contents, so that, for instance, void elements like <img /> become <img>. This means that we’re still setting innerHTML even if it might not be necessary, because Crank checks each prop value against the actual DOM before deciding to set the property (https://github.com/bikeshaving/crank/blob/3b3f8ee5334532b30cc6c86c4120c6791290d817/src/dom.ts?ts=2#L118)
Perhaps this is a more general problem? Are there other DOM properties which can change between setting and getting, such that checking the value against the DOM isn’t actually useful? Something to think about.
When you assign to
innerHTML
, the browser will normalize the contents, so that, for instance, void elements like<img />
become<img>
. This means that we’re still settinginnerHTML
even if it might not be necessary, because Crank checks each prop value against the actual DOM before deciding to set the property (https://github.com/bikeshaving/crank/blob/3b3f8ee5334532b30cc6c86c4120c6791290d817/src/dom.ts?ts=2#L118)Perhaps this is a more general problem? Are there other DOM properties which can change between setting and getting, such that checking the value against the DOM isn’t actually useful? Something to think about.