mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Widget tests: Use instance method. Also replace a few instances of $.data in widget implementations.
This commit is contained in:
parent
4fce29e935
commit
90135b27f8
@ -99,7 +99,7 @@ test( "allow form submit on enter when menu is not active", function() {
|
|||||||
delay: 0,
|
delay: 0,
|
||||||
minLength: 0
|
minLength: 0
|
||||||
});
|
});
|
||||||
element.data( "ui-autocomplete" )._move = function() {
|
element.autocomplete( "instance" )._move = function() {
|
||||||
didMove = true;
|
didMove = true;
|
||||||
};
|
};
|
||||||
element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } );
|
element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } );
|
||||||
@ -114,7 +114,7 @@ test( "allow form submit on enter when menu is not active", function() {
|
|||||||
delay: 0,
|
delay: 0,
|
||||||
minLength: 0
|
minLength: 0
|
||||||
});
|
});
|
||||||
element.data( "ui-autocomplete" )._move = function() {
|
element.autocomplete( "instance" )._move = function() {
|
||||||
ok( true, "repsond to arrow" );
|
ok( true, "repsond to arrow" );
|
||||||
};
|
};
|
||||||
element.autocomplete( "search" );
|
element.autocomplete( "search" );
|
||||||
@ -156,7 +156,7 @@ test( "ARIA", function() {
|
|||||||
var element = $( "#autocomplete" ).autocomplete({
|
var element = $( "#autocomplete" ).autocomplete({
|
||||||
source: [ "java", "javascript" ]
|
source: [ "java", "javascript" ]
|
||||||
}),
|
}),
|
||||||
liveRegion = element.data( "ui-autocomplete" ).liveRegion;
|
liveRegion = element.autocomplete( "instance" ).liveRegion;
|
||||||
|
|
||||||
equal( liveRegion.text(), "", "Empty live region on create" );
|
equal( liveRegion.text(), "", "Empty live region on create" );
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ test("open", function() {
|
|||||||
var element = $("<div></div>");
|
var element = $("<div></div>");
|
||||||
element.dialog({
|
element.dialog({
|
||||||
open: function(ev, ui) {
|
open: function(ev, ui) {
|
||||||
ok(element.data("ui-dialog")._isOpen, "interal _isOpen flag is set");
|
ok(element.dialog( "instance" )._isOpen, "interal _isOpen flag is set");
|
||||||
ok(true, "autoOpen: true fires open callback");
|
ok(true, "autoOpen: true fires open callback");
|
||||||
equal(this, element[0], "context of callback");
|
equal(this, element[0], "context of callback");
|
||||||
equal(ev.type, "dialogopen", "event type in callback");
|
equal(ev.type, "dialogopen", "event type in callback");
|
||||||
@ -30,7 +30,7 @@ test("open", function() {
|
|||||||
deepEqual(ui, {}, "ui hash in callback");
|
deepEqual(ui, {}, "ui hash in callback");
|
||||||
}
|
}
|
||||||
}).bind("dialogopen", function(ev, ui) {
|
}).bind("dialogopen", function(ev, ui) {
|
||||||
ok(element.data("ui-dialog")._isOpen, "interal _isOpen flag is set");
|
ok(element.dialog( "instance" )._isOpen, "interal _isOpen flag is set");
|
||||||
ok(true, "dialog('open') fires open event");
|
ok(true, "dialog('open') fires open event");
|
||||||
equal(this, element[0], "context of event");
|
equal(this, element[0], "context of event");
|
||||||
deepEqual(ui, {}, "ui hash in event");
|
deepEqual(ui, {}, "ui hash in event");
|
||||||
|
@ -117,7 +117,7 @@ test( "stopping the stop callback", function() {
|
|||||||
dy: 10
|
dy: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
ok( element.data("ui-draggable").helper, "the clone should not be deleted if the stop callback is stopped" );
|
ok( element.draggable( "instance" ).helper, "the clone should not be deleted if the stop callback is stopped" );
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -185,8 +185,8 @@ test( "values", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
notStrictEqual(
|
notStrictEqual(
|
||||||
ranges.eq( 0 ).data( "ui-slider" ).options.values,
|
ranges.eq( 0 ).slider( "instance" ).options.values,
|
||||||
ranges.eq( 1 ).data( "ui-slider" ).options.values,
|
ranges.eq( 1 ).slider( "instance" ).options.values,
|
||||||
"multiple range sliders should not have a reference to the same options.values array"
|
"multiple range sliders should not have a reference to the same options.values array"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ test( "nested list", function() {
|
|||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
var element = $( "#tabs6" ).tabs();
|
var element = $( "#tabs6" ).tabs();
|
||||||
equal( element.data( "ui-tabs" ).anchors.length, 2, "should contain 2 tab" );
|
equal( element.tabs( "instance" ).anchors.length, 2, "should contain 2 tab" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "disconnected from DOM", function() {
|
test( "disconnected from DOM", function() {
|
||||||
@ -155,7 +155,7 @@ asyncTest( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER",
|
|||||||
panels = element.find( ".ui-tabs-panel" ),
|
panels = element.find( ".ui-tabs-panel" ),
|
||||||
keyCode = $.ui.keyCode;
|
keyCode = $.ui.keyCode;
|
||||||
|
|
||||||
element.data( "ui-tabs" ).delay = 50;
|
element.tabs( "instance" ).delay = 50;
|
||||||
|
|
||||||
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
|
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
|
||||||
tabs.eq( 0 ).simulate( "focus" );
|
tabs.eq( 0 ).simulate( "focus" );
|
||||||
@ -306,7 +306,7 @@ asyncTest( "keyboard support - CTRL navigation", function() {
|
|||||||
panels = element.find( ".ui-tabs-panel" ),
|
panels = element.find( ".ui-tabs-panel" ),
|
||||||
keyCode = $.ui.keyCode;
|
keyCode = $.ui.keyCode;
|
||||||
|
|
||||||
element.data( "ui-tabs" ).delay = 50;
|
element.tabs( "instance" ).delay = 50;
|
||||||
|
|
||||||
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
|
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
|
||||||
tabs.eq( 0 ).simulate( "focus" );
|
tabs.eq( 0 ).simulate( "focus" );
|
||||||
|
@ -314,7 +314,7 @@ test( "hide and show: false", function() {
|
|||||||
show: false,
|
show: false,
|
||||||
hide: false
|
hide: false
|
||||||
}),
|
}),
|
||||||
widget = element.data( "ui-tabs" ),
|
widget = element.tabs( "instance" ),
|
||||||
panels = element.find( ".ui-tabs-panel" );
|
panels = element.find( ".ui-tabs-panel" );
|
||||||
widget._show = function() {
|
widget._show = function() {
|
||||||
ok( false, "_show() called" );
|
ok( false, "_show() called" );
|
||||||
@ -335,7 +335,7 @@ asyncTest( "hide and show - animation", function() {
|
|||||||
show: "drop",
|
show: "drop",
|
||||||
hide: 2000
|
hide: 2000
|
||||||
}),
|
}),
|
||||||
widget = element.data( "ui-tabs" ),
|
widget = element.tabs( "instance" ),
|
||||||
panels = element.find( ".ui-tabs-panel" );
|
panels = element.find( ".ui-tabs-panel" );
|
||||||
widget._show = function( element, options, callback ) {
|
widget._show = function( element, options, callback ) {
|
||||||
strictEqual( element[ 0 ], panels[ 1 ], "correct element in _show()" );
|
strictEqual( element[ 0 ], panels[ 1 ], "correct element in _show()" );
|
||||||
|
@ -43,28 +43,28 @@ test( "element normalization", function() {
|
|||||||
// workaround for core ticket #8381
|
// workaround for core ticket #8381
|
||||||
this.element.appendTo( "#qunit-fixture" );
|
this.element.appendTo( "#qunit-fixture" );
|
||||||
ok( this.element.is( "div" ), "generated div" );
|
ok( this.element.is( "div" ), "generated div" );
|
||||||
deepEqual( this.element.data( "ui-testWidget" ), this, "instance stored in .data()" );
|
deepEqual( this.element.testWidget( "instance" ), this, "instance stored in .data()" );
|
||||||
};
|
};
|
||||||
$.ui.testWidget();
|
$.ui.testWidget();
|
||||||
|
|
||||||
$.ui.testWidget.prototype.defaultElement = "<span data-test='pass'></span>";
|
$.ui.testWidget.prototype.defaultElement = "<span data-test='pass'></span>";
|
||||||
$.ui.testWidget.prototype._create = function() {
|
$.ui.testWidget.prototype._create = function() {
|
||||||
ok( this.element.is( "span[data-test=pass]" ), "generated span with properties" );
|
ok( this.element.is( "span[data-test=pass]" ), "generated span with properties" );
|
||||||
deepEqual( this.element.data( "ui-testWidget" ), this, "instace stored in .data()" );
|
deepEqual( this.element.testWidget( "instance" ), this, "instace stored in .data()" );
|
||||||
};
|
};
|
||||||
$.ui.testWidget();
|
$.ui.testWidget();
|
||||||
|
|
||||||
elem = $( "<input>" );
|
elem = $( "<input>" );
|
||||||
$.ui.testWidget.prototype._create = function() {
|
$.ui.testWidget.prototype._create = function() {
|
||||||
deepEqual( this.element[ 0 ], elem[ 0 ], "from element" );
|
deepEqual( this.element[ 0 ], elem[ 0 ], "from element" );
|
||||||
deepEqual( elem.data( "ui-testWidget" ), this, "instace stored in .data()" );
|
deepEqual( elem.testWidget( "instance" ), this, "instace stored in .data()" );
|
||||||
};
|
};
|
||||||
$.ui.testWidget( {}, elem[ 0 ] );
|
$.ui.testWidget( {}, elem[ 0 ] );
|
||||||
|
|
||||||
elem = $( "<div>" );
|
elem = $( "<div>" );
|
||||||
$.ui.testWidget.prototype._create = function() {
|
$.ui.testWidget.prototype._create = function() {
|
||||||
deepEqual( this.element[ 0 ], elem[ 0 ], "from jQuery object" );
|
deepEqual( this.element[ 0 ], elem[ 0 ], "from jQuery object" );
|
||||||
deepEqual( elem.data( "ui-testWidget" ), this, "instace stored in .data()" );
|
deepEqual( elem.testWidget( "instance" ), this, "instace stored in .data()" );
|
||||||
};
|
};
|
||||||
$.ui.testWidget( {}, elem );
|
$.ui.testWidget( {}, elem );
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ test( "element normalization", function() {
|
|||||||
.appendTo( "#qunit-fixture" );
|
.appendTo( "#qunit-fixture" );
|
||||||
$.ui.testWidget.prototype._create = function() {
|
$.ui.testWidget.prototype._create = function() {
|
||||||
deepEqual( this.element[ 0 ], elem[ 0 ], "from selector" );
|
deepEqual( this.element[ 0 ], elem[ 0 ], "from selector" );
|
||||||
deepEqual( elem.data( "ui-testWidget" ), this, "instace stored in .data()" );
|
deepEqual( elem.testWidget( "instance" ), this, "instace stored in .data()" );
|
||||||
};
|
};
|
||||||
$.ui.testWidget( {}, "#element-normalization-selector" );
|
$.ui.testWidget( {}, "#element-normalization-selector" );
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ test( "jQuery usage", function() {
|
|||||||
.testWidget();
|
.testWidget();
|
||||||
shouldCreate = false;
|
shouldCreate = false;
|
||||||
|
|
||||||
instance = elem.data( "ui-testWidget" );
|
instance = elem.testWidget( "instance" );
|
||||||
equal( typeof instance, "object", "instance stored in .data(pluginName)" );
|
equal( typeof instance, "object", "instance stored in .data(pluginName)" );
|
||||||
equal( instance.element[0], elem[0], "element stored on widget" );
|
equal( instance.element[0], elem[0], "element stored on widget" );
|
||||||
ret = elem.testWidget( "methodWithParams", "value1", "value2" );
|
ret = elem.testWidget( "methodWithParams", "value1", "value2" );
|
||||||
@ -149,7 +149,7 @@ test( "jQuery usage", function() {
|
|||||||
equal( ret.end(), elem, "stack preserved" );
|
equal( ret.end(), elem, "stack preserved" );
|
||||||
|
|
||||||
elem.testWidget( "destroy" );
|
elem.testWidget( "destroy" );
|
||||||
equal( elem.data( "ui-testWidget" ), null );
|
equal( elem.testWidget( "instance" ), null );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "direct usage", function() {
|
test( "direct usage", function() {
|
||||||
@ -185,7 +185,7 @@ test( "direct usage", function() {
|
|||||||
instance = new $.ui.testWidget( {}, elem );
|
instance = new $.ui.testWidget( {}, elem );
|
||||||
shouldCreate = false;
|
shouldCreate = false;
|
||||||
|
|
||||||
equal( $( elem ).data( "ui-testWidget" ), instance,
|
equal( $( elem ).testWidget( "instance" ), instance,
|
||||||
"instance stored in .data(pluginName)" );
|
"instance stored in .data(pluginName)" );
|
||||||
equal( instance.element[ 0 ], elem, "element stored on widget" );
|
equal( instance.element[ 0 ], elem, "element stored on widget" );
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ test( "._super()", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
instance = $( "<div>" ).testWidget3().data( "ui-testWidget3" );
|
instance = $( "<div>" ).testWidget3().testWidget3( "instance" );
|
||||||
instance.method( 5 );
|
instance.method( 5 );
|
||||||
delete $.ui.testWidget3;
|
delete $.ui.testWidget3;
|
||||||
delete $.ui.testWidget2;
|
delete $.ui.testWidget2;
|
||||||
@ -442,7 +442,7 @@ test( "._superApply()", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
instance = $( "<div>" ).testWidget3().data( "ui-testWidget3" );
|
instance = $( "<div>" ).testWidget3().testWidget3( "instance" );
|
||||||
instance.method( 5, 10 );
|
instance.method( 5, 10 );
|
||||||
delete $.ui.testWidget3;
|
delete $.ui.testWidget3;
|
||||||
delete $.ui.testWidget2;
|
delete $.ui.testWidget2;
|
||||||
@ -560,7 +560,7 @@ test( ".option() - deep option setter", function() {
|
|||||||
$.widget( "ui.testWidget", {} );
|
$.widget( "ui.testWidget", {} );
|
||||||
var div = $( "<div>" ).testWidget();
|
var div = $( "<div>" ).testWidget();
|
||||||
function deepOption( from, to, msg ) {
|
function deepOption( from, to, msg ) {
|
||||||
div.data( "ui-testWidget" ).options.foo = from;
|
div.testWidget( "instance" ).options.foo = from;
|
||||||
$.ui.testWidget.prototype._setOption = function( key, value ) {
|
$.ui.testWidget.prototype._setOption = function( key, value ) {
|
||||||
deepEqual( key, "foo", msg + ": key" );
|
deepEqual( key, "foo", msg + ": key" );
|
||||||
deepEqual( value, to, msg + ": value" );
|
deepEqual( value, to, msg + ": value" );
|
||||||
@ -638,7 +638,7 @@ test( ".instance()", function() {
|
|||||||
div = $( "<div>" );
|
div = $( "<div>" );
|
||||||
equal( div.testWidget( "instance" ), undefined );
|
equal( div.testWidget( "instance" ), undefined );
|
||||||
div.testWidget();
|
div.testWidget();
|
||||||
equal( div.testWidget( "instance" ), div.data( "ui-testWidget" ) );
|
equal( div.testWidget( "instance" ), div.testWidget( "instance" ) );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "._on() to element (default)", function() {
|
test( "._on() to element (default)", function() {
|
||||||
@ -856,7 +856,7 @@ test( "_on() to common element", function() {
|
|||||||
ok( true, "handler triggered" );
|
ok( true, "handler triggered" );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var widget = $( "#widget" ).testWidget().data( "ui-testWidget" );
|
var widget = $( "#widget" ).testWidget().testWidget( "instance" );
|
||||||
$( "#widget-wrapper" ).testWidget();
|
$( "#widget-wrapper" ).testWidget();
|
||||||
widget.destroy();
|
widget.destroy();
|
||||||
$( document ).trigger( "customevent" );
|
$( document ).trigger( "customevent" );
|
||||||
@ -868,7 +868,7 @@ test( "_off() - single event", function() {
|
|||||||
$.widget( "ui.testWidget", {} );
|
$.widget( "ui.testWidget", {} );
|
||||||
var shouldTriggerWidget, shouldTriggerOther,
|
var shouldTriggerWidget, shouldTriggerOther,
|
||||||
element = $( "#widget" ),
|
element = $( "#widget" ),
|
||||||
widget = element.testWidget().data( "ui-testWidget" );
|
widget = element.testWidget().testWidget( "instance" );
|
||||||
widget._on( element, { foo: function() {
|
widget._on( element, { foo: function() {
|
||||||
ok( shouldTriggerWidget, "foo called from _on" );
|
ok( shouldTriggerWidget, "foo called from _on" );
|
||||||
}});
|
}});
|
||||||
@ -889,7 +889,7 @@ test( "_off() - multiple events", function() {
|
|||||||
$.widget( "ui.testWidget", {} );
|
$.widget( "ui.testWidget", {} );
|
||||||
var shouldTriggerWidget, shouldTriggerOther,
|
var shouldTriggerWidget, shouldTriggerOther,
|
||||||
element = $( "#widget" ),
|
element = $( "#widget" ),
|
||||||
widget = element.testWidget().data( "ui-testWidget" );
|
widget = element.testWidget().testWidget( "instance" );
|
||||||
widget._on( element, {
|
widget._on( element, {
|
||||||
foo: function() {
|
foo: function() {
|
||||||
ok( shouldTriggerWidget, "foo called from _on" );
|
ok( shouldTriggerWidget, "foo called from _on" );
|
||||||
@ -917,7 +917,7 @@ test( "_off() - all events", function() {
|
|||||||
$.widget( "ui.testWidget", {} );
|
$.widget( "ui.testWidget", {} );
|
||||||
var shouldTriggerWidget, shouldTriggerOther,
|
var shouldTriggerWidget, shouldTriggerOther,
|
||||||
element = $( "#widget" ),
|
element = $( "#widget" ),
|
||||||
widget = element.testWidget().data( "ui-testWidget" );
|
widget = element.testWidget().testWidget( "instance" );
|
||||||
widget._on( element, {
|
widget._on( element, {
|
||||||
foo: function() {
|
foo: function() {
|
||||||
ok( shouldTriggerWidget, "foo called from _on" );
|
ok( shouldTriggerWidget, "foo called from _on" );
|
||||||
@ -1023,7 +1023,7 @@ test( "._trigger() - no event, no ui", function() {
|
|||||||
deepEqual( ui, {}, "empty ui hash passed" );
|
deepEqual( ui, {}, "empty ui hash passed" );
|
||||||
handlers.push( this );
|
handlers.push( this );
|
||||||
});
|
});
|
||||||
deepEqual( $( "#widget" ).data( "ui-testWidget" )._trigger( "foo" ), true,
|
deepEqual( $( "#widget" ).testWidget( "instance" )._trigger( "foo" ), true,
|
||||||
"_trigger returns true when event is not cancelled" );
|
"_trigger returns true when event is not cancelled" );
|
||||||
deepEqual( handlers, [
|
deepEqual( handlers, [
|
||||||
$( "#widget" )[ 0 ],
|
$( "#widget" )[ 0 ],
|
||||||
@ -1051,7 +1051,7 @@ test( "._trigger() - cancelled event", function() {
|
|||||||
ok( true, "event was triggered" );
|
ok( true, "event was triggered" );
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
deepEqual( $( "#widget" ).data( "ui-testWidget" )._trigger( "foo" ), false,
|
deepEqual( $( "#widget" ).testWidget( "instance" )._trigger( "foo" ), false,
|
||||||
"_trigger returns false when event is cancelled" );
|
"_trigger returns false when event is cancelled" );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1066,7 +1066,7 @@ test( "._trigger() - cancelled callback", function() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
deepEqual( $( "#widget" ).data( "ui-testWidget" )._trigger( "foo" ), false,
|
deepEqual( $( "#widget" ).testWidget( "instance" )._trigger( "foo" ), false,
|
||||||
"_trigger returns false when callback returns false" );
|
"_trigger returns false when callback returns false" );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1400,7 +1400,7 @@ asyncTest( "_delay", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "$.widget.bridge()", function() {
|
test( "$.widget.bridge()", function() {
|
||||||
expect( 9 );
|
expect( 10 );
|
||||||
|
|
||||||
var instance, ret,
|
var instance, ret,
|
||||||
elem = $( "<div>" );
|
elem = $( "<div>" );
|
||||||
@ -1428,6 +1428,7 @@ test( "$.widget.bridge()", function() {
|
|||||||
strictEqual( elem.testWidget({ foo: "bar" }), elem, "plugin returns original jQuery object" );
|
strictEqual( elem.testWidget({ foo: "bar" }), elem, "plugin returns original jQuery object" );
|
||||||
instance = elem.data( "testWidget" );
|
instance = elem.data( "testWidget" );
|
||||||
equal( typeof instance, "object", "instance stored in .data(pluginName)" );
|
equal( typeof instance, "object", "instance stored in .data(pluginName)" );
|
||||||
|
equal( typeof elem.testWidget( "instance" ), "object", "also retrievable via instance method" );
|
||||||
|
|
||||||
ret = elem.testWidget( "method", "value1" );
|
ret = elem.testWidget( "method", "value1" );
|
||||||
equal( ret, elem, "jQuery object returned from method call" );
|
equal( ret, elem, "jQuery object returned from method call" );
|
||||||
|
2
ui/jquery.ui.draggable.js
vendored
2
ui/jquery.ui.draggable.js
vendored
@ -567,7 +567,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
|
|||||||
uiSortable = $.extend({}, ui, { item: inst.element });
|
uiSortable = $.extend({}, ui, { item: inst.element });
|
||||||
inst.sortables = [];
|
inst.sortables = [];
|
||||||
$(o.connectToSortable).each(function() {
|
$(o.connectToSortable).each(function() {
|
||||||
var sortable = $.data(this, "ui-sortable");
|
var sortable = $( this ).sortable( "instance" );
|
||||||
if (sortable && !sortable.options.disabled) {
|
if (sortable && !sortable.options.disabled) {
|
||||||
inst.sortables.push({
|
inst.sortables.push({
|
||||||
instance: sortable,
|
instance: sortable,
|
||||||
|
6
ui/jquery.ui.droppable.js
vendored
6
ui/jquery.ui.droppable.js
vendored
@ -152,7 +152,7 @@ $.widget("ui.droppable", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() {
|
this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() {
|
||||||
var inst = $.data(this, "ui-droppable");
|
var inst = $( this ).droppable( "instance" );
|
||||||
if(
|
if(
|
||||||
inst.options.greedy &&
|
inst.options.greedy &&
|
||||||
!inst.options.disabled &&
|
!inst.options.disabled &&
|
||||||
@ -331,11 +331,11 @@ $.ui.ddmanager = {
|
|||||||
// find droppable parents with same scope
|
// find droppable parents with same scope
|
||||||
scope = this.options.scope;
|
scope = this.options.scope;
|
||||||
parent = this.element.parents(":data(ui-droppable)").filter(function () {
|
parent = this.element.parents(":data(ui-droppable)").filter(function () {
|
||||||
return $.data(this, "ui-droppable").options.scope === scope;
|
return $(this).droppable( "instance" ).options.scope === scope;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (parent.length) {
|
if (parent.length) {
|
||||||
parentInstance = $.data(parent[0], "ui-droppable");
|
parentInstance = $( parent[ 0 ] ).droppable( "instance" );
|
||||||
parentInstance.greedyChild = (c === "isover");
|
parentInstance.greedyChild = (c === "isover");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user