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

Preserve ordering of classes #424

Merged
merged 3 commits into from
Aug 3, 2019
Merged

Preserve ordering of classes #424

merged 3 commits into from
Aug 3, 2019

Conversation

chvp
Copy link
Contributor

@chvp chvp commented Nov 4, 2018

This should fix #393.

I didn't add functionality that preserves uniqueness of classes, since classList.add will do that for us.

src/virtual_dom/mod.rs Outdated Show resolved Hide resolved
src/virtual_dom/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@jstarry jstarry left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @charvp! Sorry for the delay in the review, do you still have interest in getting this merged? I think we could change a few things, but think it's a good problem to solve for those using semantic ui!

@chvp
Copy link
Contributor Author

chvp commented Jul 30, 2019

I'm not using yew anymore since my project using it didn't pan out, but I'll take a look at rebasing this PR and incorporating your review over the weekend.

@chvp
Copy link
Contributor Author

chvp commented Aug 3, 2019

I incorporated your comments into the pull request. However, to support the not equal assertion I had to make some changes to the eq implementation for VTag, since the IndexSet doesn't account for ordering when checking for equality.

Copy link
Member

@jstarry jstarry left a comment

Choose a reason for hiding this comment

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

Thanks so much! Just one comment and then we're good to go. Really appreciate you jumping back on this :)

@@ -546,7 +546,7 @@ impl<COMP: Component> PartialEq for VTag<COMP> {
return false;
}

if self.classes != other.classes {
if self.classes.iter().collect::<Vec<&String>>() != other.classes.iter().collect::<Vec<&String>>() {
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 you can use this for inequality: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.ne

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I tried a simple != but that didn't work. Fixed!

@jstarry
Copy link
Member

jstarry commented Aug 3, 2019

bors r+

bors bot added a commit that referenced this pull request Aug 3, 2019
424: Preserve ordering of classes r=jstarry a=charvp

This should fix #393.

I didn't add functionality that preserves uniqueness of classes, since `classList.add` will do that for us.

Co-authored-by: Charlotte Van Petegem <charlotte@vanpetegem.me>
@bors
Copy link
Contributor

bors bot commented Aug 3, 2019

Build succeeded

@bors bors bot merged commit 5abc145 into yewstack:master Aug 3, 2019
@chvp chvp deleted the ordered-classes branch August 3, 2019 15:46
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

Successfully merging this pull request may close these issues.

ordering of classes in html tags
2 participants