MithrilJS / mithril.js

A JavaScript Framework for Building Brilliant Applications
https://mithril.js.org
MIT License
14.02k stars 924 forks source link

Custom elements: built-in element extensions lose their `is` attribute #2799

Open barneycarroll opened 2 years ago

barneycarroll commented 2 years ago

As demonstrated here, a custom element that extends a built-in via the is attribute behaves strangely. The extension is recognised and the custom element is constructed as expected; but the is attribute that determined this behaviour is not present on the rendered element. Having been specified in hyperscript, I would expect it to remain.

pygy commented 2 years ago

As long as we deal with [is], we have a render bug in the update phase. is should be considered part of the element identity along with the tag name when diffing.

kfule commented 2 weeks ago

When creating elements in Javascript, “is” may need to be given not only with createElement() but also explicitly with setAttribute().

flems (same issue without mithril)

As for mithril, it may be enough to just remove the "is" exclusion below and let setAttr() work like any other attribute. https://github.com/MithrilJS/mithril.js/blob/c6ffa188f2bf729fb761d857ea690ce4e3ac73af/render/render.js#L679