#1129·snabbdom

snabbdom needs to support custom elements

Author: mreinsteinCreated Mar 31, 2025Updated Mar 31, 2025

The barest use case that comes to mind:

javascript
import html from 'https://cdn.skypack.dev/snabby''

function appView () {
   return html`<structure-diagram @attrs:myarg1="true"> </structure-diagram>`
}

This throws an error in snabbdom:

Uncaught NotSupportedError: Failed to execute 'createElement' on 'Document': The result must not have attributes.

This error is happening because when snabbdom calls document.createElement('structure-diagram', { attrs: { myarg1: 'true' } }) This fails, because passing attributes is specifically prohibited in the custom elements spec.