mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Fixes for large data sets
- Don't bind the element if it already exists - Use closest instead of parents and remove each for selectable mouseStart event
This commit is contained in:
parent
e7a10c70ae
commit
ad11d34dda
@ -590,8 +590,10 @@ $.Widget.prototype = {
|
||||
delegateElement = this.widget();
|
||||
} else {
|
||||
element = delegateElement = $( element );
|
||||
if ( !this.bindings.find(element).length ) {
|
||||
this.bindings = this.bindings.add( element );
|
||||
}
|
||||
}
|
||||
|
||||
$.each( handlers, function( event, handler ) {
|
||||
function handlerProxy() {
|
||||
|
@ -139,11 +139,10 @@ return $.widget( "ui.selectable", $.ui.mouse, {
|
||||
}
|
||||
} );
|
||||
|
||||
$( event.target ).parents().addBack().each( function() {
|
||||
var doSelect,
|
||||
selectee = $.data( this, "selectable-item" );
|
||||
if ( selectee ) {
|
||||
doSelect = ( !event.metaKey && !event.ctrlKey ) ||
|
||||
var element = $( event.target ).closest( ":data(selectable-item)" );
|
||||
if ( element.length ) {
|
||||
var selectee = element.data( "selectable-item" ),
|
||||
doSelect = ( !event.metaKey && !event.ctrlKey) ||
|
||||
!selectee.$element.hasClass( "ui-selected" );
|
||||
that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
|
||||
._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
|
||||
@ -155,15 +154,13 @@ return $.widget( "ui.selectable", $.ui.mouse, {
|
||||
if ( doSelect ) {
|
||||
that._trigger( "selecting", event, {
|
||||
selecting: selectee.element
|
||||
} );
|
||||
});
|
||||
} else {
|
||||
that._trigger( "unselecting", event, {
|
||||
unselecting: selectee.element
|
||||
} );
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user