Skip to content

Commit 47db52b

Browse files
committed
Widget: Prefix variables with component name.
1 parent f64c953 commit 47db52b

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

ui/jquery.ui.widget.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@
1010
*/
1111
(function( $, undefined ) {
1212

13-
var uuid = 0,
14-
slice = Array.prototype.slice,
15-
_cleanData = $.cleanData;
16-
$.cleanData = function( elems ) {
17-
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
18-
try {
19-
$( elem ).triggerHandler( "remove" );
20-
// http://bugs.jquery.com/ticket/8235
21-
} catch( e ) {}
22-
}
23-
_cleanData( elems );
24-
};
13+
var widget_uuid = 0,
14+
widget_slice = Array.prototype.slice;
15+
16+
$.cleanData = (function( orig ) {
17+
return function( elems ) {
18+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
19+
try {
20+
$( elem ).triggerHandler( "remove" );
21+
// http://bugs.jquery.com/ticket/8235
22+
} catch( e ) {}
23+
}
24+
orig( elems );
25+
};
26+
})( $.cleanData );
2527

2628
$.widget = function( name, base, prototype ) {
2729
var fullName, existingConstructor, constructor, basePrototype,
@@ -139,7 +141,7 @@ $.widget = function( name, base, prototype ) {
139141
};
140142

141143
$.widget.extend = function( target ) {
142-
var input = slice.call( arguments, 1 ),
144+
var input = widget_slice.call( arguments, 1 ),
143145
inputIndex = 0,
144146
inputLength = input.length,
145147
key,
@@ -168,7 +170,7 @@ $.widget.bridge = function( name, object ) {
168170
var fullName = object.prototype.widgetFullName || name;
169171
$.fn[ name ] = function( options ) {
170172
var isMethodCall = typeof options === "string",
171-
args = slice.call( arguments, 1 ),
173+
args = widget_slice.call( arguments, 1 ),
172174
returnValue = this;
173175

174176
// allow multiple hashes to be passed on init
@@ -233,7 +235,7 @@ $.Widget.prototype = {
233235
_createWidget: function( options, element ) {
234236
element = $( element || this.defaultElement || this )[ 0 ];
235237
this.element = $( element );
236-
this.uuid = uuid++;
238+
this.uuid = widget_uuid++;
237239
this.eventNamespace = "." + this.widgetName + this.uuid;
238240
this.options = $.widget.extend( {},
239241
this.options,

0 commit comments

Comments
 (0)