Open brokenalarms opened 8 years ago
Tried hyper-script
, but as per their documentation:
Note that hyperscript sets properties on the DOM element object, not attributes on the HTML element.
So basically this approach does not work with web components reliant on attributeChangedCallback
s?
Specifically, I was using morphdom
for this (which just assigns everything as attributes (to my mind, correctly for the purposes of how the element is represented in the view function), but thought I'd try hyperx
because it enabled for more generic switching layer and use of hyperxify
.
Maybe it would work if you created a thin wrapper around vdom.create
so everything is passed as attributes?
Hi
If am creating a tree that includes a webcomponent which updates on
attributeChangedCallback
. However, throughhyperx
, all specified attributes end up being passed tovirtual-dom
as props, because attributes need to be all passed together within anattributes
sub-object. Currently with a view like below:...all the three attributes end up being assigned directly to the DOM element rather than via
setAttribute
.I realize this is perhaps because
virtual-dom
does not adhere to the hyperscript API (as specified,h(tagName, attrs, children)
, whenvirtual-dom
actually takesh(tagName, props ={attributes: {} }, children)
). But ifhyperx
shouldn't be expected to account for these differences, then the documentation should probably be updated to let people know it won't work as expected withvirtual-dom
specifically and save some time :) Thanks!