Skip to content

Commit f587071

Browse files
committed
Updated all widgets to use proper data keys when getting plugin instances.
1 parent 498aadf commit f587071

12 files changed

+54
-54
lines changed

tests/unit/autocomplete/autocomplete_core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ test( "allow form submit on enter when menu is not active", function() {
9999
delay: 0,
100100
minLength: 0
101101
});
102-
element.data( "autocomplete" )._move = function() {
102+
element.data( "ui-autocomplete" )._move = function() {
103103
didMove = true;
104104
};
105105
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() {
114114
delay: 0,
115115
minLength: 0
116116
});
117-
element.data( "autocomplete" )._move = function() {
117+
element.data( "ui-autocomplete" )._move = function() {
118118
ok( true, "repsond to arrow" );
119119
};
120120
element.autocomplete( "search" );

tests/unit/dialog/dialog_events.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test("open", function() {
1111
var el = $("<div></div>");
1212
el.dialog({
1313
open: function(ev, ui) {
14-
ok(el.data("dialog")._isOpen, "interal _isOpen flag is set");
14+
ok(el.data("ui-dialog")._isOpen, "interal _isOpen flag is set");
1515
ok(true, 'autoOpen: true fires open callback');
1616
equal(this, el[0], "context of callback");
1717
equal(ev.type, 'dialogopen', 'event type in callback');
@@ -30,7 +30,7 @@ test("open", function() {
3030
deepEqual(ui, {}, 'ui hash in callback');
3131
}
3232
}).bind('dialogopen', function(ev, ui) {
33-
ok(el.data("dialog")._isOpen, "interal _isOpen flag is set");
33+
ok(el.data("ui-dialog")._isOpen, "interal _isOpen flag is set");
3434
ok(true, 'dialog("open") fires open event');
3535
equal(this, el[0], 'context of event');
3636
deepEqual(ui, {}, 'ui hash in event');

tests/unit/draggable/draggable_events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ test("stopping the stop callback", function() {
7979

8080
TestHelpers.draggable.drag(el, 10, 10);
8181

82-
ok($("#draggable2").data('draggable').helper, "the clone should not be deleted if the stop callback is stopped");
82+
ok($("#draggable2").data('ui-draggable').helper, "the clone should not be deleted if the stop callback is stopped");
8383

8484

8585
});

tests/unit/tabs/tabs_core.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test( "nested list", function() {
3333
expect( 1 );
3434

3535
var element = $( "#tabs6" ).tabs();
36-
equal( element.data( "tabs" ).anchors.length, 2, "should contain 2 tab" );
36+
equal( element.data( "ui-tabs" ).anchors.length, 2, "should contain 2 tab" );
3737
});
3838

3939
test( "disconnected from DOM", function() {
@@ -155,7 +155,7 @@ asyncTest( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER",
155155
panels = element.find( ".ui-tabs-panel" ),
156156
keyCode = $.ui.keyCode;
157157

158-
element.data( "tabs" ).delay = 50;
158+
element.data( "ui-tabs" ).delay = 50;
159159

160160
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
161161
tabs.eq( 0 ).simulate( "focus" );
@@ -306,7 +306,7 @@ asyncTest( "keyboard support - CTRL navigation", function() {
306306
panels = element.find( ".ui-tabs-panel" ),
307307
keyCode = $.ui.keyCode;
308308

309-
element.data( "tabs" ).delay = 50;
309+
element.data( "ui-tabs" ).delay = 50;
310310

311311
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
312312
tabs.eq( 0 ).simulate( "focus" );

tests/unit/tabs/tabs_options.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ test( "hide and show: false", function() {
290290
show: false,
291291
hide: false
292292
}),
293-
widget = element.data( "tabs" ),
293+
widget = element.data( "ui-tabs" ),
294294
panels = element.find( ".ui-tabs-panel" );
295295
widget._show = function() {
296296
ok( false, "_show() called" );
@@ -311,7 +311,7 @@ asyncTest( "hide and show - animation", function() {
311311
show: "drop",
312312
hide: 2000
313313
}),
314-
widget = element.data( "tabs" ),
314+
widget = element.data( "ui-tabs" ),
315315
panels = element.find( ".ui-tabs-panel" );
316316
widget._show = function( element, options, callback ) {
317317
strictEqual( element[ 0 ], panels[ 1 ], "correct element in _show()" );

ui/jquery.ui.autocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ $.widget( "ui.autocomplete", {
190190
})
191191
.zIndex( this.element.zIndex() + 1 )
192192
.hide()
193-
.data( "menu" );
193+
.data( "ui-menu" );
194194

195195
this._on( this.menu.element, {
196196
mousedown: function( event ) {

ui/jquery.ui.button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ $.widget( "ui.button", {
358358
$.widget( "ui.buttonset", {
359359
version: "@VERSION",
360360
options: {
361-
items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"
361+
items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
362362
},
363363

364364
_create: function() {

ui/jquery.ui.dialog.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ $.widget("ui.dialog", {
516516
if ( resize ) {
517517
this._size();
518518
}
519-
if ( this.uiDialog.is( ":data(resizable)" ) ) {
519+
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
520520
this.uiDialog.resizable( "option", resizableOptions );
521521
}
522522
},
@@ -546,7 +546,7 @@ $.widget("ui.dialog", {
546546
}
547547
break;
548548
case "draggable":
549-
isDraggable = uiDialog.is( ":data(draggable)" );
549+
isDraggable = uiDialog.is( ":data(ui-draggable)" );
550550
if ( isDraggable && !value ) {
551551
uiDialog.draggable( "destroy" );
552552
}
@@ -560,7 +560,7 @@ $.widget("ui.dialog", {
560560
break;
561561
case "resizable":
562562
// currently resizable, becoming non-resizable
563-
isResizable = uiDialog.is( ":data(resizable)" );
563+
isResizable = uiDialog.is( ":data(ui-resizable)" );
564564
if ( isResizable && !value ) {
565565
uiDialog.resizable( "destroy" );
566566
}
@@ -621,7 +621,7 @@ $.widget("ui.dialog", {
621621
this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
622622
}
623623

624-
if (this.uiDialog.is( ":data(resizable)" ) ) {
624+
if (this.uiDialog.is( ":data(ui-resizable)" ) ) {
625625
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
626626
}
627627
}

ui/jquery.ui.draggable.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,11 @@ $.widget("ui.draggable", $.ui.mouse, {
506506
$.ui.plugin.add("draggable", "connectToSortable", {
507507
start: function(event, ui) {
508508

509-
var inst = $(this).data("draggable"), o = inst.options,
509+
var inst = $(this).data("ui-draggable"), o = inst.options,
510510
uiSortable = $.extend({}, ui, { item: inst.element });
511511
inst.sortables = [];
512512
$(o.connectToSortable).each(function() {
513-
var sortable = $.data(this, 'sortable');
513+
var sortable = $.data(this, 'ui-sortable');
514514
if (sortable && !sortable.options.disabled) {
515515
inst.sortables.push({
516516
instance: sortable,
@@ -525,7 +525,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
525525
stop: function(event, ui) {
526526

527527
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
528-
var inst = $(this).data("draggable"),
528+
var inst = $(this).data("ui-draggable"),
529529
uiSortable = $.extend({}, ui, { item: inst.element });
530530

531531
$.each(inst.sortables, function() {
@@ -558,7 +558,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
558558
},
559559
drag: function(event, ui) {
560560

561-
var inst = $(this).data("draggable"), that = this;
561+
var inst = $(this).data("ui-draggable"), that = this;
562562

563563
$.each(inst.sortables, function() {
564564

@@ -592,7 +592,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
592592
//Now we fake the start of dragging for the sortable instance,
593593
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
594594
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
595-
this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
595+
this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("ui-sortable-item", true);
596596
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
597597
this.instance.options.helper = function() { return ui.helper[0]; };
598598

@@ -652,36 +652,36 @@ $.ui.plugin.add("draggable", "connectToSortable", {
652652

653653
$.ui.plugin.add("draggable", "cursor", {
654654
start: function() {
655-
var t = $('body'), o = $(this).data('draggable').options;
655+
var t = $('body'), o = $(this).data('ui-draggable').options;
656656
if (t.css("cursor")) o._cursor = t.css("cursor");
657657
t.css("cursor", o.cursor);
658658
},
659659
stop: function() {
660-
var o = $(this).data('draggable').options;
660+
var o = $(this).data('ui-draggable').options;
661661
if (o._cursor) $('body').css("cursor", o._cursor);
662662
}
663663
});
664664

665665
$.ui.plugin.add("draggable", "opacity", {
666666
start: function(event, ui) {
667-
var t = $(ui.helper), o = $(this).data('draggable').options;
667+
var t = $(ui.helper), o = $(this).data('ui-draggable').options;
668668
if(t.css("opacity")) o._opacity = t.css("opacity");
669669
t.css('opacity', o.opacity);
670670
},
671671
stop: function(event, ui) {
672-
var o = $(this).data('draggable').options;
672+
var o = $(this).data('ui-draggable').options;
673673
if(o._opacity) $(ui.helper).css('opacity', o._opacity);
674674
}
675675
});
676676

677677
$.ui.plugin.add("draggable", "scroll", {
678678
start: function() {
679-
var i = $(this).data("draggable");
679+
var i = $(this).data("ui-draggable");
680680
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
681681
},
682682
drag: function( event ) {
683683

684-
var i = $(this).data("draggable"), o = i.options, scrolled = false;
684+
var i = $(this).data("ui-draggable"), o = i.options, scrolled = false;
685685

686686
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
687687

@@ -726,10 +726,10 @@ $.ui.plugin.add("draggable", "scroll", {
726726
$.ui.plugin.add("draggable", "snap", {
727727
start: function() {
728728

729-
var i = $(this).data("draggable"), o = i.options;
729+
var i = $(this).data("ui-draggable"), o = i.options;
730730
i.snapElements = [];
731731

732-
$(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
732+
$(o.snap.constructor != String ? ( o.snap.items || ':data(ui-draggable)' ) : o.snap).each(function() {
733733
var $t = $(this); var $o = $t.offset();
734734
if(this != i.element[0]) i.snapElements.push({
735735
item: this,
@@ -741,7 +741,7 @@ $.ui.plugin.add("draggable", "snap", {
741741
},
742742
drag: function(event, ui) {
743743

744-
var inst = $(this).data("draggable"), o = inst.options;
744+
var inst = $(this).data("ui-draggable"), o = inst.options;
745745
var d = o.snapTolerance;
746746

747747
var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
@@ -795,7 +795,7 @@ $.ui.plugin.add("draggable", "snap", {
795795
$.ui.plugin.add("draggable", "stack", {
796796
start: function() {
797797

798-
var o = $(this).data("draggable").options;
798+
var o = $(this).data("ui-draggable").options;
799799

800800
var group = $.makeArray($(o.stack)).sort(function(a,b) {
801801
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
@@ -814,12 +814,12 @@ $.ui.plugin.add("draggable", "stack", {
814814

815815
$.ui.plugin.add("draggable", "zIndex", {
816816
start: function(event, ui) {
817-
var t = $(ui.helper), o = $(this).data("draggable").options;
817+
var t = $(ui.helper), o = $(this).data("ui-draggable").options;
818818
if(t.css("zIndex")) o._zIndex = t.css("zIndex");
819819
t.css('zIndex', o.zIndex);
820820
},
821821
stop: function(event, ui) {
822-
var o = $(this).data("draggable").options;
822+
var o = $(this).data("ui-draggable").options;
823823
if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
824824
}
825825
});

ui/jquery.ui.droppable.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ $.widget("ui.droppable", {
110110
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
111111

112112
var childrenIntersection = false;
113-
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
114-
var inst = $.data(this, 'droppable');
113+
this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() {
114+
var inst = $.data(this, 'ui-droppable');
115115
if(
116116
inst.options.greedy
117117
&& !inst.options.disabled
@@ -193,7 +193,7 @@ $.ui.ddmanager = {
193193

194194
var m = $.ui.ddmanager.droppables[t.options.scope] || [];
195195
var type = event ? event.type : null; // workaround for #2317
196-
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
196+
var list = (t.currentItem || t.element).find(":data(ui-droppable)").andSelf();
197197

198198
droppablesLoop: for (var i = 0; i < m.length; i++) {
199199

@@ -257,12 +257,12 @@ $.ui.ddmanager = {
257257
if (this.options.greedy) {
258258
// find droppable parents with same scope
259259
var scope = this.options.scope;
260-
var parent = this.element.parents(':data(droppable)').filter(function () {
261-
return $.data(this, 'droppable').options.scope === scope;
260+
var parent = this.element.parents(':data(ui-droppable)').filter(function () {
261+
return $.data(this, 'ui-droppable').options.scope === scope;
262262
});
263263

264264
if (parent.length) {
265-
parentInstance = $.data(parent[0], 'droppable');
265+
parentInstance = $.data(parent[0], 'ui-droppable');
266266
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
267267
}
268268
}

0 commit comments

Comments
 (0)