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

Fix handling of boolean attributes #840

Merged
merged 5 commits into from
Jan 6, 2020
Merged

Conversation

mrh0057
Copy link
Contributor

@mrh0057 mrh0057 commented Jan 3, 2020

Issue #394

@jstarry
Copy link
Member

jstarry commented Jan 4, 2020

Thanks @mrh0057! This has long been needed 👍

Could you please run cargo fmt on rustc 1.40.0?

#vtag.add_attribute("disabled", &"true");
}
}
});
let add_selected = selected.iter().map(|selected| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need special handling for selected with your change. Can you please remove the special handling and ensure that selected works properly as a boolean attribute?

@@ -24,6 +24,53 @@ pub enum ClassesForm {
Single(Expr),
}

lazy_static! {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a comment saying what the source of this list is?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this list is not totally correct, see this comment: https://gist.github.com/ArjanSchouten/0b8574a6ad7f5065a5e7#gistcomment-2717606

@jstarry jstarry changed the title Updated so boolean attributes are either there or not. Fix handling of boolean attributes Jan 6, 2020
@jstarry jstarry added the bug label Jan 6, 2020
@jstarry
Copy link
Member

jstarry commented Jan 6, 2020

@mrh0057 please add back checked special handling. See this comment: https://github.com/yewstack/yew/blob/master/src/virtual_dom/vtag.rs#L48

@mrh0057
Copy link
Contributor Author

mrh0057 commented Jan 6, 2020

The list you referenced is the one I used. I'm going through and manually checking on MDN each attribute in the list to see if it's a boolean attribute since the list is inaccurate.

@mrh0057
Copy link
Contributor Author

mrh0057 commented Jan 6, 2020

I went over this page: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes with all of the tags listed on the other github page. I also removed ones listed that only function if set using JavaScript.

@jstarry
Copy link
Member

jstarry commented Jan 6, 2020

Great, thanks! Looks good, I'll merge once CI passes

@jstarry jstarry merged commit c7c9dcd into yewstack:master Jan 6, 2020
llebout pushed a commit to llebout/yew that referenced this pull request Jan 20, 2020
* Updated so boolean attributes are either there or not.

Issue yewstack#394

* Ran cargo fmt.

* Updated to remove checked and selected special handling.

* Update the attribute list to match what mdn says.

Removed deceprated attributes.

* Added back the checked special handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants