-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Attributes: .removeClass() -> .attr( "class", "" ) #2465
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
Conversation
|
I like it. |
|
:) After reviewing the code, I commit again to save 7 bytes on |
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.
I wonder why it was done in the first place
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.
Here, it was for removing all the classes when we call .removeClass() without any argument, but I write a special if (with the .attr) only for this case.
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.
Probably to save the function call? Probably not worth the extra code. The trimming was added in e76ba32 to avoid leading/trailing space.
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.
it's not for saving a function call, it was a specific behaviour, if the value of the user is undefined we set an empty class attribute. It is really more simple to read the specific case of .removeClass() now.
|
@mr21 friendly ping |
|
Oh sorry, I was extremely focused on something else this time. I've tested the @markelog's version but it's not saving anything, probably because the Anyway, the remove of |
5b6ab7f to
4aa5911
Compare
Hi :)
After asking a question about a specific part of
.removeClasson IRC and after @Krinkle told me that the call of.removeClass()without any arguments cleaning all the"class"attribute. I watch the code and I've found that this particularity made the code different compared to.addClass.And if you call
this.attr( "class", "" )directly in aifwe can save 17 bytes after gzipped.I add another change in another commit to save other 2 bytes on
.hasClass.