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,7 +590,9 @@ $.Widget.prototype = {
|
|||||||
delegateElement = this.widget();
|
delegateElement = this.widget();
|
||||||
} else {
|
} else {
|
||||||
element = delegateElement = $( element );
|
element = delegateElement = $( element );
|
||||||
this.bindings = this.bindings.add( element );
|
if ( !this.bindings.find(element).length ) {
|
||||||
|
this.bindings = this.bindings.add( element );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$.each( handlers, function( event, handler ) {
|
$.each( handlers, function( event, handler ) {
|
||||||
|
@ -139,31 +139,28 @@ return $.widget( "ui.selectable", $.ui.mouse, {
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$( event.target ).parents().addBack().each( function() {
|
var element = $( event.target ).closest( ":data(selectable-item)" );
|
||||||
var doSelect,
|
if ( element.length ) {
|
||||||
selectee = $.data( this, "selectable-item" );
|
var selectee = element.data( "selectable-item" ),
|
||||||
if ( selectee ) {
|
doSelect = ( !event.metaKey && !event.ctrlKey) ||
|
||||||
doSelect = ( !event.metaKey && !event.ctrlKey ) ||
|
|
||||||
!selectee.$element.hasClass( "ui-selected" );
|
!selectee.$element.hasClass( "ui-selected" );
|
||||||
that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
|
that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
|
||||||
._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
|
._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
|
||||||
selectee.unselecting = !doSelect;
|
selectee.unselecting = !doSelect;
|
||||||
selectee.selecting = doSelect;
|
selectee.selecting = doSelect;
|
||||||
selectee.selected = doSelect;
|
selectee.selected = doSelect;
|
||||||
|
|
||||||
// selectable (UN)SELECTING callback
|
// selectable (UN)SELECTING callback
|
||||||
if ( doSelect ) {
|
if ( doSelect ) {
|
||||||
that._trigger( "selecting", event, {
|
that._trigger( "selecting", event, {
|
||||||
selecting: selectee.element
|
selecting: selectee.element
|
||||||
} );
|
});
|
||||||
} else {
|
} else {
|
||||||
that._trigger( "unselecting", event, {
|
that._trigger( "unselecting", event, {
|
||||||
unselecting: selectee.element
|
unselecting: selectee.element
|
||||||
} );
|
});
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} );
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user