Skip to content

API doesn't match for virtual-dom - no way to set attributes? #37

@brokenalarms

Description

@brokenalarms

Hi

If am creating a tree that includes a webcomponent which updates on attributeChangedCallback. However, through hyperx, all specified attributes end up being passed to virtual-dom as props, because attributes need to be all passed together within an attributes sub-object.
Currently with a view like below:

return html `<my-web-component class="${className}"
                            data-src="${src}"
                            style="display:flex;width:${width}px;height:${height}px">
                        </my-web-component>`

...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), when virtual-dom actually takes h(tagName, props ={attributes: {} }, children)). But if hyperx 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 with virtual-dom specifically and save some time :) Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions