Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes on component's root tag #2761

Closed
bradisbell opened this issue Sep 15, 2019 · 3 comments
Closed

Attributes on component's root tag #2761

bradisbell opened this issue Sep 15, 2019 · 3 comments
Assignees

Comments

@bradisbell
Copy link

It doesn't seem to be possible to add attributes to a custom component's root tag. For example:

<my-tag is="svg" viewbox="0 0 16 9" xmlns="http://www.w3.org/2000/svg">
   ...
</my-tag>

Then when I use the tag:

<svg is="my-tag"></svg>

In the output, the viewbox and xmlns attributes don't appear.

This is particularly problematic in SVG where I'd like to accept height/width attributes. Is this possible?

@GianlucaGuarini
Copy link
Member

GianlucaGuarini commented Sep 15, 2019

I can enhance the compiler to match these attributes but for now a quick workaround for it is to set them as expressions:

<my-tag viewbox={'0 0 16 9'} xmlns={'http://www.w3.org/2000/svg'}>
   ...
</my-tag>

@GianlucaGuarini
Copy link
Member

Side note: is="svg" doesn't make really sense as attribute

@GianlucaGuarini
Copy link
Member

Fixed in Riot.js@4.6.3 https://plnkr.co/edit/1HMkDgB7YQMn7kh4BaGy?p=preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants