8000 `webc.renderAttributes` loses dashes from original attribute names · Issue #216 · 11ty/webc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
webc.renderAttributes loses dashes from original attribute names #216
Open
@Gyanreyer

Description

@Gyanreyer

I have a component which accepts data- attributes like data-image-width. Obviously this gets serialized as dataImageWidth on the webc.attributes object, but then if you run webc.renderAttributes(webc.attributes), the attribute ends up getting serialized as dataimagewidth, losing the dashes. Here's a template which should reproduce it:

<!-- my-component.webc -->
<script webc:type="js" webc:root="override">
  `<div ${webc.renderAttributes(webc.attributes)}></div>`
</script>
<!-- page.webc -->
<my-component data-image-width="100"></my-component>

Current output:

<div dataimagewidth="100"></div>

Desired output:

<div data-image-width="100"></div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0