Skip to content
Permalink
Browse files

Widget: Prefix variables with component name.

  • Loading branch information
scottgonzalez committed Oct 24, 2013
1 parent f64c953 commit 47db52b9c98a5c593eb86e5b75309568d11b3bef
Showing with 17 additions and 15 deletions.
  1. +17 −15 ui/jquery.ui.widget.js
@@ -10,18 +10,20 @@
*/
(function( $, undefined ) {

var uuid = 0,
slice = Array.prototype.slice,
_cleanData = $.cleanData;
$.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
try {
$( elem ).triggerHandler( "remove" );
// http://bugs.jquery.com/ticket/8235
} catch( e ) {}
}
_cleanData( elems );
};
var widget_uuid = 0,
widget_slice = Array.prototype.slice;

$.cleanData = (function( orig ) {
return function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
try {
$( elem ).triggerHandler( "remove" );
// http://bugs.jquery.com/ticket/8235
} catch( e ) {}
}
orig( elems );
};
})( $.cleanData );

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

$.widget.extend = function( target ) {
var input = slice.call( arguments, 1 ),
var input = widget_slice.call( arguments, 1 ),
inputIndex = 0,
inputLength = input.length,
key,
@@ -168,7 +170,7 @@ $.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = slice.call( arguments, 1 ),
args = widget_slice.call( arguments, 1 ),
returnValue = this;

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

0 comments on commit 47db52b

Please sign in to comment.
You can’t perform that action at this time.