diff options
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r-- | ui/jquery.ui.widget.js | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 2d48ae26d..1b7405e28 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -1,7 +1,7 @@ /*! * jQuery UI Widget @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * @@ -36,7 +36,7 @@ $.widget = function( name, base, prototype ) { // create selector for plugin $.expr[ ":" ][ fullName ] = function( elem ) { - return !!$.data( elem, name ); + return !!$.data( elem, fullName ); }; $[ namespace ] = $[ namespace ] || {}; @@ -105,7 +105,9 @@ $.widget = function( name, base, prototype ) { constructor: constructor, namespace: namespace, widgetName: name, - widgetBaseClass: fullName + // TODO remove widgetBaseClass, see #8155 + widgetBaseClass: fullName, + widgetFullName: fullName }); // If this widget is being redefined then we need to find all widgets that @@ -148,6 +150,7 @@ $.widget.extend = function( target ) { }; $.widget.bridge = function( name, object ) { + var fullName = object.prototype.widgetFullName; $.fn[ name ] = function( options ) { var isMethodCall = typeof options === "string", args = slice.call( arguments, 1 ), @@ -160,7 +163,7 @@ $.widget.bridge = function( name, object ) { if ( isMethodCall ) { this.each(function() { - var instance = $.data( this, name ); + var instance = $.data( this, fullName ); if ( !instance ) { return $.error( "cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'" ); @@ -178,7 +181,7 @@ $.widget.bridge = function( name, object ) { }); } else { this.each(function() { - var instance = $.data( this, name ); + var instance = $.data( this, fullName ); if ( instance ) { instance.option( options || {} )._init(); } else { @@ -217,7 +220,10 @@ $.Widget.prototype = { this.focusable = $(); if ( element !== this ) { + // 1.9 BC for #7810 + // TODO remove dual storage $.data( element, this.widgetName, this ); + $.data( element, this.widgetFullName, this ); this._bind({ remove: "destroy" }); this.document = $( element.style ? // element within the document @@ -242,12 +248,15 @@ $.Widget.prototype = { // all event bindings should go through this._bind() this.element .unbind( "." + this.widgetName ) - .removeData( this.widgetName ); + // 1.9 BC for #7810 + // TODO remove dual storage + .removeData( this.widgetName ) + .removeData( this.widgetFullName ); this.widget() .unbind( "." + this.widgetName ) .removeAttr( "aria-disabled" ) .removeClass( - this.widgetBaseClass + "-disabled " + + this.widgetFullName + "-disabled " + "ui-state-disabled" ); // clean up events and states @@ -314,7 +323,7 @@ $.Widget.prototype = { if ( key === "disabled" ) { this.widget() - .toggleClass( this.widgetBaseClass + "-disabled ui-state-disabled", !!value ) + .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value ) .attr( "aria-disabled", value ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); |