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

Custom HTML attributes #295

Closed
saschagrunert opened this issue Jun 24, 2018 · 10 comments
Closed

Custom HTML attributes #295

saschagrunert opened this issue Jun 24, 2018 · 10 comments

Comments

@saschagrunert
Copy link
Contributor

saschagrunert commented Jun 24, 2018

Hey, is there a way to insert custom html attributes like this:

<div uk-spinner></div>
@limira
Copy link
Contributor

limira commented Jun 24, 2018

Is this helpful? I am not sure, because it just contains a value, while you want a key: value. How about uk-spinner-ratio = "3"?

And if you did not notice yet, it requires a trailing comma:

<div uk-spinner-ratio="3", ></div>

@saschagrunert
Copy link
Contributor Author

saschagrunert commented Jun 24, 2018

I think my example was a bit misleading. Some UI Frameworks labeling the HTML like this:
<div uk-spinner></div>, so there is no value for the key.

@davidkna
Copy link
Contributor

<div uk-spinner></div> is equivalent to <div uk-spinner=""></div> which you should be able to use.

@kellytk
Copy link
Contributor

kellytk commented Jun 25, 2018

@davidkna Are those equivalent in the HTML spec?

@saschagrunert
Copy link
Contributor Author

Alright, that solves the problem. Thanks!

@davidkna
Copy link
Contributor

@kellytk yes they are, at least according to the w3c one: http://w3c.github.io/html/infrastructure.html#sec-boolean-attributes

@kellytk
Copy link
Contributor

kellytk commented Jul 3, 2018

Thanks @davidkna

@saschagrunert
Copy link
Contributor Author

With the latest changes it does not work any more: saschagrunert/webapp.rs#345

Is there a way how to use custom macros with the latest master version of the HTML macro?

                html! {
                    <div class="uk-position-center", uk-icon="icon: cloud-download; ratio: 3",></div>
                }
error: unexpected token
   --> frontend/src/component/root.rs:139:54
    |
139 |                     <div class="uk-position-center", uk-icon="icon: cloud-download; ratio: 3",></div>
    |                                                      ^^

@saschagrunert saschagrunert reopened this Jul 3, 2019
@jstarry
Copy link
Member

jstarry commented Jul 28, 2019

This should be working on yew 0.7. Here's the corresponding fix: #512

@saschagrunert can you confirm please?

@saschagrunert
Copy link
Contributor Author

Yes, it’s fixed. Thank you!

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

No branches or pull requests

5 participants