Fix for #3838 - Components should use this.widgetName on internally

This commit is contained in:
Eduardo Lundgren 2009-01-16 00:33:46 +00:00
parent 358be8bd46
commit 78c4d87d7b
10 changed files with 172 additions and 111 deletions

View File

@ -12,11 +12,18 @@
*/ */
(function($) { (function($) {
var widgetName = "accordion";
var classWidgetName = ".accordion";
$.widget("ui.accordion", { $.widget("ui.accordion", {
_init: function() { _init: function() {
var options = this.options; var options = this.options;
// update widgetName with the name given by the widget factory
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
if ( options.navigation ) { if ( options.navigation ) {
var current = this.element.find("a").filter(options.navigationFilter); var current = this.element.find("a").filter(options.navigationFilter);
if ( current.length ) { if ( current.length ) {
@ -32,8 +39,8 @@ $.widget("ui.accordion", {
this.element.addClass("ui-accordion ui-widget ui-helper-reset"); this.element.addClass("ui-accordion ui-widget ui-helper-reset");
var groups = this.element.children().addClass("ui-accordion-group"); var groups = this.element.children().addClass("ui-accordion-group");
var headers = options.headers = groups.find("> :first-child").addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all") var headers = options.headers = groups.find("> :first-child").addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all")
.bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); }) .bind("mouseenter." + widgetName, function(){ $(this).addClass('ui-state-hover'); })
.bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); }); .bind("mouseleave." + widgetName, function(){ $(this).removeClass('ui-state-hover'); });
// wrap content elements in div against animation issues // wrap content elements in div against animation issues
headers.next().wrap("<div></div>").addClass("ui-accordion-content").parent().addClass("ui-accordion-content-wrap ui-helper-reset ui-widget-content ui-corner-bottom"); headers.next().wrap("<div></div>").addClass("ui-accordion-content").parent().addClass("ui-accordion-content-wrap ui-helper-reset ui-widget-content ui-corner-bottom");
@ -79,15 +86,15 @@ $.widget("ui.accordion", {
options.headers.find('a').attr('tabIndex','-1'); options.headers.find('a').attr('tabIndex','-1');
if (options.event) { if (options.event) {
this.element.bind((options.event) + ".accordion", clickHandler); this.element.bind((options.event) + classWidgetName, clickHandler);
} }
}, },
destroy: function() { destroy: function() {
this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion"); this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(classWidgetName);
$.removeData(this.element[0], "accordion"); $.removeData(this.element[0], widgetName);
var groups = this.element.children().removeClass("ui-accordion-group "+this.options.selectedClass); var groups = this.element.children().removeClass("ui-accordion-group "+this.options.selectedClass);
var headers = this.options.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top") var headers = this.options.headers.unbind(classWidgetName).removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top")
.removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex"); .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
headers.find("a").removeAttr("tabindex"); headers.find("a").removeAttr("tabindex");
headers.children(".ui-icon").remove(); headers.children(".ui-icon").remove();
@ -168,11 +175,11 @@ function scopeCallback(callback, scope) {
function completed(cancel) { function completed(cancel) {
// if removed while animated data can be empty // if removed while animated data can be empty
if (!$.data(this, "accordion")) { if (!$.data(this, widgetName)) {
return; return;
} }
var instance = $.data(this, "accordion"); var instance = $.data(this, widgetName);
var options = instance.options; var options = instance.options;
options.running = cancel ? 0 : --options.running; options.running = cancel ? 0 : --options.running;
if ( options.running ) { if ( options.running ) {
@ -188,13 +195,13 @@ function completed(cancel) {
} }
function toggle(toShow, toHide, data, clickedActive, down) { function toggle(toShow, toHide, data, clickedActive, down) {
var options = $.data(this, "accordion").options; var options = $.data(this, widgetName).options;
options.toShow = toShow; options.toShow = toShow;
options.toHide = toHide; options.toHide = toHide;
options.data = data; options.data = data;
var complete = scopeCallback(completed, this); var complete = scopeCallback(completed, this);
$.data(this, "accordion")._trigger("changestart", null, options.data); $.data(this, widgetName)._trigger("changestart", null, options.data);
// count elements to animate // count elements to animate
options.running = toHide.size() === 0 ? toShow.size() : toHide.size(); options.running = toHide.size() === 0 ? toShow.size() : toHide.size();
@ -263,7 +270,7 @@ function toggle(toShow, toHide, data, clickedActive, down) {
} }
function clickHandler(event) { function clickHandler(event) {
var options = $.data(this, "accordion").options; var options = $.data(this, widgetName).options;
if (options.disabled) { if (options.disabled) {
return false; return false;
} }

View File

@ -14,6 +14,9 @@
*/ */
(function($) { (function($) {
var widgetName = "dialog";
var classWidgetName = ".dialog";
var setDataSwitch = { var setDataSwitch = {
dragStart: "start.draggable", dragStart: "start.draggable",
drag: "drag.draggable", drag: "drag.draggable",
@ -30,6 +33,10 @@ var setDataSwitch = {
$.widget("ui.dialog", { $.widget("ui.dialog", {
_init: function() { _init: function() {
// update widgetName with the name given by the widget factory
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
this.originalTitle = this.element.attr('title'); this.originalTitle = this.element.attr('title');
this.options.title = this.options.title || this.originalTitle; this.options.title = this.options.title || this.originalTitle;
@ -61,7 +68,7 @@ $.widget("ui.dialog", {
&& ev.keyCode == $.ui.keyCode.ESCAPE && self.close()); && ev.keyCode == $.ui.keyCode.ESCAPE && self.close());
}) })
.attr({ .attr({
role: 'dialog', role: widgetName,
'aria-labelledby': titleId 'aria-labelledby': titleId
}) })
.mousedown(function() { .mousedown(function() {
@ -152,8 +159,8 @@ $.widget("ui.dialog", {
(this.overlay && this.overlay.destroy()); (this.overlay && this.overlay.destroy());
this.uiDialog.hide(); this.uiDialog.hide();
this.element this.element
.unbind('.dialog') .unbind(classWidgetName)
.removeData('dialog') .removeData(widgetName)
.removeClass('ui-dialog-content ui-widget-content') .removeClass('ui-dialog-content ui-widget-content')
.hide().appendTo('body'); .hide().appendTo('body');
this.uiDialog.remove(); this.uiDialog.remove();

View File

@ -12,9 +12,15 @@
*/ */
(function($) { (function($) {
var widgetName = "draggable";
var classWidgetName = ".draggable";
$.widget("ui.draggable", $.extend({}, $.ui.mouse, { $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
_init: function() { _init: function() {
// update widgetName with the name given by the widget factory
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
this.element[0].style.position = 'relative'; this.element[0].style.position = 'relative';
@ -27,8 +33,8 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
}, },
destroy: function() { destroy: function() {
if(!this.element.data('draggable')) return; if(!this.element.data(widgetName)) return;
this.element.removeData("draggable").unbind(".draggable").removeClass(this.options.cssNamespace+'-draggable '+this.options.cssNamespace+'-draggable-dragging '+this.options.cssNamespace+'-draggable-disabled'); this.element.removeData(widgetName).unbind(classWidgetName).removeClass(this.options.cssNamespace+'-draggable '+this.options.cssNamespace+'-draggable-dragging '+this.options.cssNamespace+'-draggable-disabled');
this._mouseDestroy(); this._mouseDestroy();
}, },
@ -426,10 +432,10 @@ $.extend($.ui.draggable, {
} }
}); });
$.ui.plugin.add("draggable", "connectToSortable", { $.ui.plugin.add(widgetName, "connectToSortable", {
start: function(event, ui) { start: function(event, ui) {
var inst = $(this).data("draggable"); var inst = $(this).data(widgetName);
inst.sortables = []; inst.sortables = [];
$(ui.options.connectToSortable).each(function() { $(ui.options.connectToSortable).each(function() {
// 'this' points to a string, and should therefore resolved as query, but instead, if the string is assigned to a variable, it loops through the strings properties, // 'this' points to a string, and should therefore resolved as query, but instead, if the string is assigned to a variable, it loops through the strings properties,
@ -451,7 +457,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
stop: function(event, ui) { stop: function(event, ui) {
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
var inst = $(this).data("draggable"); var inst = $(this).data(widgetName);
$.each(inst.sortables, function() { $.each(inst.sortables, function() {
if(this.instance.isOver) { if(this.instance.isOver) {
@ -486,7 +492,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
}, },
drag: function(event, ui) { drag: function(event, ui) {
var inst = $(this).data("draggable"), self = this; var inst = $(this).data(widgetName), self = this;
var checkPos = function(o) { var checkPos = function(o) {
var dyClick = this.offset.click.top, dxClick = this.offset.click.left; var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
@ -556,7 +562,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
} }
}); });
$.ui.plugin.add("draggable", "cursor", { $.ui.plugin.add(widgetName, "cursor", {
start: function(event, ui) { start: function(event, ui) {
var t = $('body'); var t = $('body');
if (t.css("cursor")) ui.options._cursor = t.css("cursor"); if (t.css("cursor")) ui.options._cursor = t.css("cursor");
@ -567,7 +573,7 @@ $.ui.plugin.add("draggable", "cursor", {
} }
}); });
$.ui.plugin.add("draggable", "iframeFix", { $.ui.plugin.add(widgetName, "iframeFix", {
start: function(event, ui) { start: function(event, ui) {
$(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() { $(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
@ -584,7 +590,7 @@ $.ui.plugin.add("draggable", "iframeFix", {
} }
}); });
$.ui.plugin.add("draggable", "opacity", { $.ui.plugin.add(widgetName, "opacity", {
start: function(event, ui) { start: function(event, ui) {
var t = $(ui.helper); var t = $(ui.helper);
if(t.css("opacity")) ui.options._opacity = t.css("opacity"); if(t.css("opacity")) ui.options._opacity = t.css("opacity");
@ -595,10 +601,10 @@ $.ui.plugin.add("draggable", "opacity", {
} }
}); });
$.ui.plugin.add("draggable", "scroll", { $.ui.plugin.add(widgetName, "scroll", {
start: function(event, ui) { start: function(event, ui) {
var o = ui.options; var o = ui.options;
var i = $(this).data("draggable"); var i = $(this).data(widgetName);
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
@ -606,7 +612,7 @@ $.ui.plugin.add("draggable", "scroll", {
drag: function(event, ui) { drag: function(event, ui) {
var o = ui.options, scrolled = false; var o = ui.options, scrolled = false;
var i = $(this).data("draggable"); var i = $(this).data(widgetName);
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
@ -640,10 +646,10 @@ $.ui.plugin.add("draggable", "scroll", {
} }
}); });
$.ui.plugin.add("draggable", "snap", { $.ui.plugin.add(widgetName, "snap", {
start: function(event, ui) { start: function(event, ui) {
var inst = $(this).data("draggable"); var inst = $(this).data(widgetName);
inst.snapElements = []; inst.snapElements = [];
$(ui.options.snap.constructor != String ? ( ui.options.snap.items || ':data(draggable)' ) : ui.options.snap).each(function() { $(ui.options.snap.constructor != String ? ( ui.options.snap.items || ':data(draggable)' ) : ui.options.snap).each(function() {
@ -658,7 +664,7 @@ $.ui.plugin.add("draggable", "snap", {
}, },
drag: function(event, ui) { drag: function(event, ui) {
var inst = $(this).data("draggable"); var inst = $(this).data(widgetName);
var d = ui.options.snapTolerance; var d = ui.options.snapTolerance;
var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width, var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,
@ -709,7 +715,7 @@ $.ui.plugin.add("draggable", "snap", {
} }
}); });
$.ui.plugin.add("draggable", "stack", { $.ui.plugin.add(widgetName, "stack", {
start: function(event, ui) { start: function(event, ui) {
var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) { var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) {
return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min); return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min);
@ -723,7 +729,7 @@ $.ui.plugin.add("draggable", "stack", {
} }
}); });
$.ui.plugin.add("draggable", "zIndex", { $.ui.plugin.add(widgetName, "zIndex", {
start: function(event, ui) { start: function(event, ui) {
var t = $(ui.helper); var t = $(ui.helper);
if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex"); if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");

View File

@ -13,9 +13,15 @@
*/ */
(function($) { (function($) {
var widgetName = "droppable";
var classWidgetName = ".droppable";
$.widget("ui.droppable", { $.widget("ui.droppable", {
_init: function() { _init: function() {
// update widgetName with the name given by the widget factory
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
var o = this.options, accept = o.accept; var o = this.options, accept = o.accept;
this.isover = 0; this.isout = 1; this.isover = 0; this.isout = 1;
@ -43,8 +49,8 @@ $.widget("ui.droppable", {
this.element this.element
.removeClass(this.options.cssNamespace+"-droppable "+this.options.cssNamespace+"-droppable-disabled") .removeClass(this.options.cssNamespace+"-droppable "+this.options.cssNamespace+"-droppable-disabled")
.removeData("droppable") .removeData(widgetName)
.unbind(".droppable"); .unbind(classWidgetName);
}, },
_setData: function(key, value) { _setData: function(key, value) {
@ -105,8 +111,8 @@ $.widget("ui.droppable", {
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
var childrenIntersection = false; var childrenIntersection = false;
this.element.find(":data(droppable)").not("."+draggable.options.cssNamespace+"-draggable-dragging").each(function() { this.element.find(":data(" + widgetName + ")").not("."+draggable.options.cssNamespace+"-draggable-dragging").each(function() {
var inst = $.data(this, 'droppable'); var inst = $.data(this, widgetName);
if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) { if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
childrenIntersection = true; return false; childrenIntersection = true; return false;
} }
@ -203,10 +209,9 @@ $.ui.ddmanager = {
current: null, current: null,
droppables: { 'default': [] }, droppables: { 'default': [] },
prepareOffsets: function(t, event) { prepareOffsets: function(t, event) {
var m = $.ui.ddmanager.droppables[t.options.scope]; var m = $.ui.ddmanager.droppables[t.options.scope];
var type = event ? event.type : null; // workaround for #2317 var type = event ? event.type : null; // workaround for #2317
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); var list = (t.currentItem || t.element).find(":data(" + widgetName + ")").andSelf();
droppablesLoop: for (var i = 0; i < m.length; i++) { droppablesLoop: for (var i = 0; i < m.length; i++) {
@ -257,9 +262,9 @@ $.ui.ddmanager = {
var parentInstance; var parentInstance;
if (this.options.greedy) { if (this.options.greedy) {
var parent = this.element.parents(':data(droppable):eq(0)'); var parent = this.element.parents(':data(' + widgetName + '):eq(0)');
if (parent.length) { if (parent.length) {
parentInstance = $.data(parent[0], 'droppable'); parentInstance = $.data(parent[0], widgetName);
parentInstance.greedyChild = (c == 'isover' ? 1 : 0); parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
} }
} }
@ -289,7 +294,7 @@ $.ui.ddmanager = {
* Droppable Extensions * Droppable Extensions
*/ */
$.ui.plugin.add("droppable", "activeClass", { $.ui.plugin.add(widgetName, "activeClass", {
activate: function(event, ui) { activate: function(event, ui) {
$(this).addClass(ui.options.activeClass); $(this).addClass(ui.options.activeClass);
}, },
@ -301,7 +306,7 @@ $.ui.plugin.add("droppable", "activeClass", {
} }
}); });
$.ui.plugin.add("droppable", "hoverClass", { $.ui.plugin.add(widgetName, "hoverClass", {
over: function(event, ui) { over: function(event, ui) {
$(this).addClass(ui.options.hoverClass); $(this).addClass(ui.options.hoverClass);
}, },

View File

@ -12,9 +12,15 @@
*/ */
(function($) { (function($) {
var widgetName = "progressbar";
var classWidgetName = ".progressbar";
$.widget("ui.progressbar", { $.widget("ui.progressbar", {
_init: function() { _init: function() {
// update widgetName with the name given by the widget factory
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
var self = this, var self = this,
options = this.options; options = this.options;
@ -25,7 +31,7 @@ $.widget("ui.progressbar", {
+ " ui-widget-content" + " ui-widget-content"
+ " ui-corner-all") + " ui-corner-all")
.attr({ .attr({
role: "progressbar", role: widgetName,
"aria-valuemin": this._valueMin(), "aria-valuemin": this._valueMin(),
"aria-valuemax": this._valueMax(), "aria-valuemax": this._valueMax(),
"aria-valuenow": this._value() "aria-valuenow": this._value()
@ -48,8 +54,8 @@ $.widget("ui.progressbar", {
.removeAttr("aria-valuemin") .removeAttr("aria-valuemin")
.removeAttr("aria-valuemax") .removeAttr("aria-valuemax")
.removeAttr("aria-valuenow") .removeAttr("aria-valuenow")
.removeData("progressbar") .removeData(widgetName)
.unbind(".progressbar"); .unbind(classWidgetName);
this.valueDiv.remove(); this.valueDiv.remove();

View File

@ -12,9 +12,15 @@
*/ */
(function($) { (function($) {
var widgetName = "resizable";
var classWidgetName = ".resizable";
$.widget("ui.resizable", $.extend({}, $.ui.mouse, { $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
_init: function() { _init: function() {
// update widgetName with the name given by the widget factory
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
var self = this, o = this.options; var self = this, o = this.options;
@ -83,7 +89,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
var oel = this.element; this.element = this.element.parent(); var oel = this.element; this.element = this.element.parent();
// store instance on wrapper // store instance on wrapper
this.element.data('resizable', this); this.element.data(widgetName, this);
//Move margins to the wrapper //Move margins to the wrapper
this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"), this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"),
@ -228,7 +234,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
var _destroy = function(exp) { var _destroy = function(exp) {
$(exp).removeClass("ui-resizable ui-resizable-disabled") $(exp).removeClass("ui-resizable ui-resizable-disabled")
.removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); .removeData(widgetName).unbind(classWidgetName).find('.ui-resizable-handle').remove();
}; };
_destroy(el); _destroy(el);
@ -570,10 +576,10 @@ $.extend($.ui.resizable, {
* Resizable Extensions * Resizable Extensions
*/ */
$.ui.plugin.add("resizable", "alsoResize", { $.ui.plugin.add(widgetName, "alsoResize", {
start: function(event, ui) { start: function(event, ui) {
var o = ui.options, self = $(this).data("resizable"), var o = ui.options, self = $(this).data(widgetName),
_store = function(exp) { _store = function(exp) {
$(exp).each(function() { $(exp).each(function() {
@ -593,7 +599,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
}, },
resize: function(event, ui){ resize: function(event, ui){
var o = ui.options, self = $(this).data("resizable"), os = self.originalSize, op = self.originalPosition; var o = ui.options, self = $(this).data(widgetName), os = self.originalSize, op = self.originalPosition;
var delta = { var delta = {
height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0, height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
@ -625,10 +631,10 @@ $.ui.plugin.add("resizable", "alsoResize", {
} }
}); });
$.ui.plugin.add("resizable", "animate", { $.ui.plugin.add(widgetName, "animate", {
stop: function(event, ui) { stop: function(event, ui) {
var o = ui.options, self = $(this).data("resizable"); var o = ui.options, self = $(this).data(widgetName);
var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName), var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName),
soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
@ -664,10 +670,10 @@ $.ui.plugin.add("resizable", "animate", {
}); });
$.ui.plugin.add("resizable", "containment", { $.ui.plugin.add(widgetName, "containment", {
start: function(event, ui) { start: function(event, ui) {
var o = ui.options, self = $(this).data("resizable"), el = self.element; var o = ui.options, self = $(this).data(widgetName), el = self.element;
var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
if (!ce) return; if (!ce) return;
@ -699,7 +705,7 @@ $.ui.plugin.add("resizable", "containment", {
}, },
resize: function(event, ui) { resize: function(event, ui) {
var o = ui.options, self = $(this).data("resizable"), var o = ui.options, self = $(this).data(widgetName),
ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
pRatio = o._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement; pRatio = o._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
@ -733,7 +739,7 @@ $.ui.plugin.add("resizable", "containment", {
}, },
stop: function(event, ui){ stop: function(event, ui){
var o = ui.options, self = $(this).data("resizable"), cp = self.position, var o = ui.options, self = $(this).data(widgetName), cp = self.position,
co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement; co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height; var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
@ -747,10 +753,10 @@ $.ui.plugin.add("resizable", "containment", {
} }
}); });
$.ui.plugin.add("resizable", "ghost", { $.ui.plugin.add(widgetName, "ghost", {
start: function(event, ui) { start: function(event, ui) {
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize, cs = self.size; var o = ui.options, self = $(this).data(widgetName), pr = o.proportionallyResize, cs = self.size;
if (!pr) self.ghost = self.element.clone(); if (!pr) self.ghost = self.element.clone();
else self.ghost = pr.clone(); else self.ghost = pr.clone();
@ -765,23 +771,23 @@ $.ui.plugin.add("resizable", "ghost", {
}, },
resize: function(event, ui){ resize: function(event, ui){
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize; var o = ui.options, self = $(this).data(widgetName), pr = o.proportionallyResize;
if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width }); if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
}, },
stop: function(event, ui){ stop: function(event, ui){
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize; var o = ui.options, self = $(this).data(widgetName), pr = o.proportionallyResize;
if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0)); if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
} }
}); });
$.ui.plugin.add("resizable", "grid", { $.ui.plugin.add(widgetName, "grid", {
resize: function(event, ui) { resize: function(event, ui) {
var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey; var o = ui.options, self = $(this).data(widgetName), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);

View File

@ -12,9 +12,16 @@
*/ */
(function($) { (function($) {
var widgetName = "selectable";
var classWidgetName = ".selectable";
$.widget("ui.selectable", $.extend({}, $.ui.mouse, { $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
_init: function() { _init: function() {
// update widgetName with the name given by the widget factory
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
var self = this; var self = this;
this.element.addClass("ui-selectable"); this.element.addClass("ui-selectable");
@ -56,8 +63,8 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
destroy: function() { destroy: function() {
this.element this.element
.removeClass("ui-selectable ui-selectable-disabled") .removeClass("ui-selectable ui-selectable-disabled")
.removeData("selectable") .removeData(widgetName)
.unbind(".selectable"); .unbind(classWidgetName);
this._mouseDestroy(); this._mouseDestroy();
}, },

View File

@ -13,9 +13,15 @@
(function($) { (function($) {
var widgetName = "slider";
var classWidgetName = ".slider";
$.widget("ui.slider", $.extend({}, $.ui.mouse, { $.widget("ui.slider", $.extend({}, $.ui.mouse, {
_init: function() { _init: function() {
// update widgetName with the name given by the widget factory
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
var self = this, o = this.options; var self = this, o = this.options;
this._keySliding = false; this._keySliding = false;
@ -160,8 +166,8 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
+ " ui-widget" + " ui-widget"
+ " ui-widget-content" + " ui-widget-content"
+ " ui-corner-all") + " ui-corner-all")
.removeData("slider") .removeData(widgetName)
.unbind(".slider"); .unbind(classWidgetName);
this._mouseDestroy(); this._mouseDestroy();

View File

@ -12,8 +12,14 @@
*/ */
(function($) { (function($) {
var widgetName = "sortable";
var classWidgetName = ".sortable";
$.widget("ui.sortable", $.extend({}, $.ui.mouse, { $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
_init: function() { _init: function() {
// update widgetName with the name given by the widget factory
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
var o = this.options; var o = this.options;
this.containerCache = {}; this.containerCache = {};
@ -36,8 +42,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
destroy: function() { destroy: function() {
this.element this.element
.removeClass(this.options.cssNamespace+"-sortable "+this.options.cssNamespace+"-sortable-disabled") .removeClass(this.options.cssNamespace+"-sortable "+this.options.cssNamespace+"-sortable-disabled")
.removeData("sortable") .removeData(widgetName)
.unbind(".sortable"); .unbind(classWidgetName);
this._mouseDestroy(); this._mouseDestroy();
for ( var i = this.items.length - 1; i >= 0; i-- ) for ( var i = this.items.length - 1; i >= 0; i-- )
@ -421,7 +427,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
for (var i = this.options.connectWith.length - 1; i >= 0; i--){ for (var i = this.options.connectWith.length - 1; i >= 0; i--){
var cur = $(this.options.connectWith[i]); var cur = $(this.options.connectWith[i]);
for (var j = cur.length - 1; j >= 0; j--){ for (var j = cur.length - 1; j >= 0; j--){
var inst = $.data(cur[j], 'sortable'); var inst = $.data(cur[j], widgetName);
if(inst && inst != this && !inst.options.disabled) { if(inst && inst != this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not("."+inst.options.cssNamespace+"-sortable-helper"), inst]); queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not("."+inst.options.cssNamespace+"-sortable-helper"), inst]);
} }
@ -468,7 +474,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
for (var i = this.options.connectWith.length - 1; i >= 0; i--){ for (var i = this.options.connectWith.length - 1; i >= 0; i--){
var cur = $(this.options.connectWith[i]); var cur = $(this.options.connectWith[i]);
for (var j = cur.length - 1; j >= 0; j--){ for (var j = cur.length - 1; j >= 0; j--){
var inst = $.data(cur[j], 'sortable'); var inst = $.data(cur[j], widgetName);
if(inst && inst != this && !inst.options.disabled) { if(inst && inst != this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
this.containers.push(inst); this.containers.push(inst);
@ -943,38 +949,38 @@ $.extend($.ui.sortable, {
* Sortable Extensions * Sortable Extensions
*/ */
$.ui.plugin.add("sortable", "cursor", { $.ui.plugin.add(widgetName, "cursor", {
start: function(event, ui) { start: function(event, ui) {
var t = $('body'), i = $(this).data('sortable'); var t = $('body'), i = $(this).data(widgetName);
if (t.css("cursor")) i.options._cursor = t.css("cursor"); if (t.css("cursor")) i.options._cursor = t.css("cursor");
t.css("cursor", i.options.cursor); t.css("cursor", i.options.cursor);
}, },
beforeStop: function(event, ui) { beforeStop: function(event, ui) {
var i = $(this).data('sortable'); var i = $(this).data(widgetName);
if (i.options._cursor) $('body').css("cursor", i.options._cursor); if (i.options._cursor) $('body').css("cursor", i.options._cursor);
} }
}); });
$.ui.plugin.add("sortable", "opacity", { $.ui.plugin.add(widgetName, "opacity", {
start: function(event, ui) { start: function(event, ui) {
var t = ui.helper, i = $(this).data('sortable'); var t = ui.helper, i = $(this).data(widgetName);
if(t.css("opacity")) i.options._opacity = t.css("opacity"); if(t.css("opacity")) i.options._opacity = t.css("opacity");
t.css('opacity', i.options.opacity); t.css('opacity', i.options.opacity);
}, },
beforeStop: function(event, ui) { beforeStop: function(event, ui) {
var i = $(this).data('sortable'); var i = $(this).data(widgetName);
if(i.options._opacity) $(ui.helper).css('opacity', i.options._opacity); if(i.options._opacity) $(ui.helper).css('opacity', i.options._opacity);
} }
}); });
$.ui.plugin.add("sortable", "scroll", { $.ui.plugin.add(widgetName, "scroll", {
start: function(event, ui) { start: function(event, ui) {
var i = $(this).data("sortable"), o = i.options; var i = $(this).data(widgetName), o = i.options;
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
}, },
sort: function(event, ui) { sort: function(event, ui) {
var i = $(this).data("sortable"), o = i.options, scrolled = false; var i = $(this).data(widgetName), o = i.options, scrolled = false;
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
@ -1008,14 +1014,14 @@ $.ui.plugin.add("sortable", "scroll", {
} }
}); });
$.ui.plugin.add("sortable", "zIndex", { $.ui.plugin.add(widgetName, "zIndex", {
start: function(event, ui) { start: function(event, ui) {
var t = ui.helper, i = $(this).data('sortable'); var t = ui.helper, i = $(this).data(widgetName);
if(t.css("zIndex")) i.options._zIndex = t.css("zIndex"); if(t.css("zIndex")) i.options._zIndex = t.css("zIndex");
t.css('zIndex', i.options.zIndex); t.css('zIndex', i.options.zIndex);
}, },
beforeStop: function(event, ui) { beforeStop: function(event, ui) {
var i = $(this).data('sortable'); var i = $(this).data(widgetName);
if(i.options._zIndex) $(ui.helper).css('zIndex', i.options._zIndex == 'auto' ? '' : i.options._zIndex); if(i.options._zIndex) $(ui.helper).css('zIndex', i.options._zIndex == 'auto' ? '' : i.options._zIndex);
} }
}); });

View File

@ -12,28 +12,33 @@
*/ */
(function($) { (function($) {
var widgetName = "tabs";
var classWidgetName = ".tabs";
$.widget("ui.tabs", { $.widget("ui.tabs", {
_init: function() { _init: function() {
widgetName = this.widgetName;
classWidgetName = '.' + widgetName;
// create tabs // create tabs
this._tabify(true); this._tabify(true);
}, },
destroy: function() { destroy: function() {
var o = this.options; var o = this.options;
this.list.unbind('.tabs') this.list.unbind(classWidgetName)
.removeClass(o.navClass).removeData('tabs'); .removeClass(o.navClass).removeData(widgetName);
this.$tabs.each(function() { this.$tabs.each(function() {
var href = $.data(this, 'href.tabs'); var href = $.data(this, 'href.' + widgetName);
if (href) if (href)
this.href = href; this.href = href;
var $this = $(this).unbind('.tabs'); var $this = $(this).unbind(classWidgetName);
$.each(['href', 'load', 'cache'], function(i, prefix) { $.each(['href', 'load', 'cache'], function(i, prefix) {
$this.removeData(prefix + '.tabs'); $this.removeData(prefix + classWidgetName);
}); });
}); });
this.$lis.unbind('.tabs').add(this.$panels).each(function() { this.$lis.unbind(classWidgetName).add(this.$panels).each(function() {
if ($.data(this, 'destroy.tabs')) if ($.data(this, 'destroy.' + widgetName))
$(this).remove(); $(this).remove();
else else
$(this).removeClass([o.tabClass, o.selectedClass, o.deselectableClass, $(this).removeClass([o.tabClass, o.selectedClass, o.deselectableClass,
@ -85,15 +90,15 @@ $.widget("ui.tabs", {
self.$panels = self.$panels.add(self._sanitizeSelector(a.hash)); self.$panels = self.$panels.add(self._sanitizeSelector(a.hash));
// remote tab // remote tab
else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#" else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"
$.data(a, 'href.tabs', a.href); // required for restore on destroy $.data(a, 'href.' + widgetName, a.href); // required for restore on destroy
$.data(a, 'load.tabs', a.href); // mutable $.data(a, 'load.' + widgetName, a.href); // mutable
var id = self._tabId(a); var id = self._tabId(a);
a.href = '#' + id; a.href = '#' + id;
var $panel = $('#' + id); var $panel = $('#' + id);
if (!$panel.length) { if (!$panel.length) {
$panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass) $panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
.insertAfter(self.$panels[i - 1] || self.list); .insertAfter(self.$panels[i - 1] || self.list);
$panel.data('destroy.tabs', true); $panel.data('destroy.' + widgetName, true);
} }
self.$panels = self.$panels.add($panel); self.$panels = self.$panels.add($panel);
} }
@ -163,7 +168,7 @@ $.widget("ui.tabs", {
}; };
// load if remote tab // load if remote tab
if ($.data(this.$tabs[o.selected], 'load.tabs')) if ($.data(this.$tabs[o.selected], 'load.' + widgetName))
this.load(o.selected, onShow); this.load(o.selected, onShow);
// just trigger show event // just trigger show event
else onShow(); else onShow();
@ -173,16 +178,16 @@ $.widget("ui.tabs", {
var handleState = function(state, el) { var handleState = function(state, el) {
if (el.is(':not(.' + o.disabledClass + ')')) el.toggleClass('ui-state-' + state); if (el.is(':not(.' + o.disabledClass + ')')) el.toggleClass('ui-state-' + state);
}; };
this.$lis.bind('mouseover.tabs mouseout.tabs', function() { this.$lis.bind(['mouseover.', widgetName, ' mouseout.', widgetName].join(''), function() {
handleState('hover', $(this)); handleState('hover', $(this));
}); });
this.$tabs.bind('focus.tabs blur.tabs', function() { this.$tabs.bind(['focus.', widgetName, ' blur.', widgetName].join(''), function() {
handleState('focus', $(this).parents('li:first')); handleState('focus', $(this).parents('li:first'));
}); });
// clean up to avoid memory leaks in certain versions of IE 6 // clean up to avoid memory leaks in certain versions of IE 6
$(window).bind('unload', function() { $(window).bind('unload', function() {
self.$lis.add(self.$tabs).unbind('.tabs'); self.$lis.add(self.$tabs).unbind(classWidgetName);
self.$lis = self.$tabs = self.$panels = null; self.$lis = self.$tabs = self.$panels = null;
}); });
@ -199,7 +204,7 @@ $.widget("ui.tabs", {
$(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass); $(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
// reset cache if switching from cached to not cached // reset cache if switching from cached to not cached
if (o.cache === false) this.$tabs.removeData('cache.tabs'); if (o.cache === false) this.$tabs.removeData('cache.' + widgetName);
// set up animations // set up animations
var hideFx, showFx; var hideFx, showFx;
@ -257,7 +262,7 @@ $.widget("ui.tabs", {
} }
// attach tab event handler, unbind to avoid duplicates from former tabifying... // attach tab event handler, unbind to avoid duplicates from former tabifying...
this.$tabs.unbind('.tabs').bind(o.event + '.tabs', function() { this.$tabs.unbind(classWidgetName).bind(o.event + classWidgetName, function() {
//var trueClick = event.clientX; // add to history only if true click occured, not a triggered click //var trueClick = event.clientX; // add to history only if true click occured, not a triggered click
var $li = $(this).parents('li:eq(0)'), var $li = $(this).parents('li:eq(0)'),
@ -335,7 +340,7 @@ $.widget("ui.tabs", {
}); });
// disable click if event is configured to something else // disable click if event is configured to something else
if (o.event != 'click') this.$tabs.bind('click.tabs', function(){return false;}); if (o.event != 'click') this.$tabs.bind('click.' + widgetName, function(){return false;});
}, },
@ -345,7 +350,7 @@ $.widget("ui.tabs", {
var o = this.options; var o = this.options;
var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)); var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
$li.addClass(o.tabClass).data('destroy.tabs', true); $li.addClass(o.tabClass).data('destroy.' + widgetName, true);
var id = url.indexOf('#') == 0 ? url.replace('#', '') : this._tabId( $('a:first-child', $li)[0] ); var id = url.indexOf('#') == 0 ? url.replace('#', '') : this._tabId( $('a:first-child', $li)[0] );
@ -354,7 +359,7 @@ $.widget("ui.tabs", {
if (!$panel.length) { if (!$panel.length) {
$panel = $(o.panelTemplate).attr('id', id) $panel = $(o.panelTemplate).attr('id', id)
.addClass(o.hideClass) .addClass(o.hideClass)
.data('destroy.tabs', true); .data('destroy.' + widgetName, true);
} }
$panel.addClass(o.panelClass); $panel.addClass(o.panelClass);
if (index >= this.$lis.length) { if (index >= this.$lis.length) {
@ -374,7 +379,7 @@ $.widget("ui.tabs", {
if (this.$tabs.length == 1) { if (this.$tabs.length == 1) {
$li.addClass(o.selectedClass); $li.addClass(o.selectedClass);
$panel.removeClass(o.hideClass); $panel.removeClass(o.hideClass);
var href = $.data(this.$tabs[0], 'load.tabs'); var href = $.data(this.$tabs[0], 'load.' + widgetName);
if (href) this.load(index, href); if (href) this.load(index, href);
} }
@ -436,18 +441,18 @@ $.widget("ui.tabs", {
// TODO make null as argument work // TODO make null as argument work
if (typeof index == 'string') if (typeof index == 'string')
index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] ); index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );
this.$tabs.eq(index).trigger(this.options.event + '.tabs'); this.$tabs.eq(index).trigger(this.options.event + classWidgetName);
}, },
load: function(index, callback) { // callback is for internal usage only load: function(index, callback) { // callback is for internal usage only
var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0], var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],
bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs'); bypassCache = callback == undefined || callback === false, url = $a.data('load.' + widgetName);
callback = callback || function() {}; callback = callback || function() {};
// no remote or from cache - just finish with callback // no remote or from cache - just finish with callback
if (!url || !bypassCache && $.data(a, 'cache.tabs')) { if (!url || !bypassCache && $.data(a, 'cache.' + widgetName)) {
callback(); callback();
return; return;
} }
@ -462,7 +467,7 @@ $.widget("ui.tabs", {
self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass) self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass)
.each(function() { .each(function() {
if (o.spinner) if (o.spinner)
inner(this).parent().html(inner(this).data('label.tabs')); inner(this).parent().html(inner(this).data('label.' + widgetName));
}); });
self.xhr = null; self.xhr = null;
}; };
@ -470,7 +475,7 @@ $.widget("ui.tabs", {
if (o.spinner) { if (o.spinner) {
var label = inner(a).html(); var label = inner(a).html();
inner(a).wrapInner('<em></em>') inner(a).wrapInner('<em></em>')
.find('em').data('label.tabs', label).html(o.spinner); .find('em').data('label.' + widgetName, label).html(o.spinner);
} }
var ajaxOptions = $.extend({}, o.ajaxOptions, { var ajaxOptions = $.extend({}, o.ajaxOptions, {
@ -480,7 +485,7 @@ $.widget("ui.tabs", {
cleanup(); cleanup();
if (o.cache) if (o.cache)
$.data(a, 'cache.tabs', true); // if loaded once do not load them again $.data(a, 'cache.' + widgetName, true); // if loaded once do not load them again
// callbacks // callbacks
self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index])); self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index]));
@ -505,7 +510,7 @@ $.widget("ui.tabs", {
}, },
url: function(index, url) { url: function(index, url) {
this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url); this.$tabs.eq(index).removeData('cache.' + widgetName).data('load.' + widgetName, url);
}, },
ui: function(tab, panel) { ui: function(tab, panel) {
@ -577,9 +582,9 @@ $.extend($.ui.tabs.prototype, {
if (ms) { if (ms) {
start(); start();
if (!continuing) if (!continuing)
this.$tabs.bind(this.options.event + '.tabs', stop); this.$tabs.bind(this.options.event + classWidgetName, stop);
else else
this.$tabs.bind(this.options.event + '.tabs', function() { this.$tabs.bind(this.options.event + classWidgetName, function() {
stop(); stop();
t = self.options.selected; t = self.options.selected;
start(); start();
@ -588,7 +593,7 @@ $.extend($.ui.tabs.prototype, {
// stop interval // stop interval
else { else {
stop(); stop();
this.$tabs.unbind(this.options.event + '.tabs', stop); this.$tabs.unbind(this.options.event + classWidgetName, stop);
} }
} }
}); });