-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Classes #1411
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
Classes #1411
Conversation
var current, i; | ||
for ( i = 0; i < classes.length; i++ ) { | ||
current = that.classObject[ classes[ i ] ] ? that.classObject[ classes[ i ] ] : $(); | ||
that.classObject[ classes[ i ] ] = current[ add ? "add" : "not" ]( element ); |
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.
jQuery's add
method order elements by DOM position, even when detached. I don't know the exact complexity of that method, but its very slow for more than a handful of elements. Is there a way to avoid using add
completely?
If not, what are the odds for current
containing more than 1, 10 and 100 elements?
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.
Whenever .not()
is used, a new jQuery instance is needed with no stack to avoid memory leaks. See _off()
for an example.
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.
We can avoid the ordering slowness with (untested):
current = $( $.unique( current.get().concat( element.get() ) ) );
This would have decent parity with the required .not()
handling too :-P
Since the empty default classes are gone, can you start a list somewhere that list all the properties for each |
for ( classKey in value ) { | ||
if ( value[ classKey ] !== this.options.classes[ classKey ] ) { | ||
if ( this.classObject[ classKey ] && this.classObject[ classKey ].length > 0 ) { | ||
elements = $.extend( {}, this.classObject[ classKey ] ); |
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.
Is this trying to clone a jQuery instance?
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.
Extraneous space after =
.
this.mouseHandled = true; | ||
} | ||
this._addClass( "ui-menu", "ui-widget ui-widget-content" ) | ||
._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length ) |
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.
Existing issue, should probably address it here anyway: This call duplicates parts of refresh()
, which is called later in this method. Maybe there is a reason for the duplication, but I guess that its just an oversight. If so, this line should be dropped.
This has terrible UX that we shouldn't promote anymore.
This addes a new built in option to the widget factory classes which maps structural classes to theme classes. To make this possible it introduces three new documented widget methods _addClass, _removeClass, and _toggleClass.
activeClass
andhoverClass
to use classes insteadghost
option to use classes insteadicon
option? NO (IRC Log) arschmitz@f0d8601#commitcomment-9961378