-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Do not set empty classes and support option wrapped class names #1085
Conversation
Thanks! Do you mind adding a testcase as well to make sure this doesn't happen again? |
I added test cases that check with |
I have found, that
I will quickly add a test-case, which will fail for now. |
There are multiple possibilities:
All of the above possibilities require different browser minimum versions. |
This reverts commit 41bfbc3.
I reverted the change to use the |
@LiquidBlock this looks good :) I was hoping you would treat "class" as an attribute and I wasn't disappointed! I'm now thinking we could take this one step further! What if we remove I think we would need to remove the |
yew/examples/crm/src/markdown.rs Lines 45 to 47 in 731f989
yew/yew-router/examples/guide/src/markdown.rs Lines 47 to 49 in 9f286d1
|
That is a good idea to remove a lot of "duplicate" code and changing the implementation.
|
I think we should get rid of |
I dont know why it says, that i requested a review from hgzimmerman. |
I guess it happened automatically, since yew-router/examples/guide/src/markdown.rs is owned by hgzimmerman. |
I removed I was not sure how to fix the markdown examples:
I added a method in those example, which parses the class string into Classes, adds the classes and sets those classes back to the VTag: https://github.com/yewstack/yew/pull/1085/files#diff-3e5d43901a65fa6fb6f5cff21489390dR7-R17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Much cleaner :) I'm wondering now if we should remove set_classes
. What do you think?
The guide example for the router is getting removed in another open PR, so no worries. Glad to see the new CODEOWNERS file doing it's job. |
Add possibility to use different types in the class tuple Add convertion to Classes from Option<T> where T: AsRef<str>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the way this turned out! Great work. Just a few small nits and then we can get this in :)
Add `::` to create an absolute path to std
@jstarry thank you for the detailed code review. |
The beta job of Travis failed with: (https://travis-ci.com/github/yewstack/yew/jobs/324520704)
Should the title of this PR be updated to signify that also optional classes are possible now? |
That's fine, just CI flakiness :/
Yes, I just updated!
Looks excellent, thank you for bearing with my feedback. |
Hello,
this is a follow-up PR of #927 (which resolved #926).
className
(https://developer.mozilla.org/en-US/docs/Web/API/Element/className) instead ofsetAttribute("class", ...)
. (Fix wrong order of classes when reordering or adding classes to the front #927 (comment))html!
macro without specifying aclass
attribute, the attribute is still set in the DOM. I propose to not set the class name if the classes set is empty when there is no ancestor, see https://github.com/yewstack/yew/compare/master...liquidblock:set-class-name?expand=1#diff-5925cef252f837778e2d2be90760083fR217.E.g. The following view
results in (as of version 0.14.3):
Fixes: #936