mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-12-07 06:14:24 +00:00
Widget: Prefix variables with component name.
This commit is contained in:
parent
f64c953497
commit
47db52b9c9
20
ui/jquery.ui.widget.js
vendored
20
ui/jquery.ui.widget.js
vendored
@ -10,18 +10,20 @@
|
|||||||
*/
|
*/
|
||||||
(function( $, undefined ) {
|
(function( $, undefined ) {
|
||||||
|
|
||||||
var uuid = 0,
|
var widget_uuid = 0,
|
||||||
slice = Array.prototype.slice,
|
widget_slice = Array.prototype.slice;
|
||||||
_cleanData = $.cleanData;
|
|
||||||
$.cleanData = function( elems ) {
|
$.cleanData = (function( orig ) {
|
||||||
|
return function( elems ) {
|
||||||
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
||||||
try {
|
try {
|
||||||
$( elem ).triggerHandler( "remove" );
|
$( elem ).triggerHandler( "remove" );
|
||||||
// http://bugs.jquery.com/ticket/8235
|
// http://bugs.jquery.com/ticket/8235
|
||||||
} catch( e ) {}
|
} catch( e ) {}
|
||||||
}
|
}
|
||||||
_cleanData( elems );
|
orig( elems );
|
||||||
};
|
};
|
||||||
|
})( $.cleanData );
|
||||||
|
|
||||||
$.widget = function( name, base, prototype ) {
|
$.widget = function( name, base, prototype ) {
|
||||||
var fullName, existingConstructor, constructor, basePrototype,
|
var fullName, existingConstructor, constructor, basePrototype,
|
||||||
@ -139,7 +141,7 @@ $.widget = function( name, base, prototype ) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$.widget.extend = function( target ) {
|
$.widget.extend = function( target ) {
|
||||||
var input = slice.call( arguments, 1 ),
|
var input = widget_slice.call( arguments, 1 ),
|
||||||
inputIndex = 0,
|
inputIndex = 0,
|
||||||
inputLength = input.length,
|
inputLength = input.length,
|
||||||
key,
|
key,
|
||||||
@ -168,7 +170,7 @@ $.widget.bridge = function( name, object ) {
|
|||||||
var fullName = object.prototype.widgetFullName || name;
|
var fullName = object.prototype.widgetFullName || name;
|
||||||
$.fn[ name ] = function( options ) {
|
$.fn[ name ] = function( options ) {
|
||||||
var isMethodCall = typeof options === "string",
|
var isMethodCall = typeof options === "string",
|
||||||
args = slice.call( arguments, 1 ),
|
args = widget_slice.call( arguments, 1 ),
|
||||||
returnValue = this;
|
returnValue = this;
|
||||||
|
|
||||||
// allow multiple hashes to be passed on init
|
// allow multiple hashes to be passed on init
|
||||||
@ -233,7 +235,7 @@ $.Widget.prototype = {
|
|||||||
_createWidget: function( options, element ) {
|
_createWidget: function( options, element ) {
|
||||||
element = $( element || this.defaultElement || this )[ 0 ];
|
element = $( element || this.defaultElement || this )[ 0 ];
|
||||||
this.element = $( element );
|
this.element = $( element );
|
||||||
this.uuid = uuid++;
|
this.uuid = widget_uuid++;
|
||||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||||
this.options = $.widget.extend( {},
|
this.options = $.widget.extend( {},
|
||||||
this.options,
|
this.options,
|
||||||
|
Loading…
Reference in New Issue
Block a user