Skip to content

Commit

Permalink
Core: Move variables for .uniqueId()/.removeUniqueId() into their imp…
Browse files Browse the repository at this point in the history
…lementations.
  • Loading branch information
scottgonzalez committed Oct 24, 2013
1 parent 8a9fb52 commit 9e6095a
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions ui/jquery.ui.core.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*/ */
(function( $, undefined ) { (function( $, undefined ) {


var uuid = 0,
runiqueId = /^ui-id-\d+$/;

// $.ui might exist from components with no dependencies, e.g., $.ui.position // $.ui might exist from components with no dependencies, e.g., $.ui.position
$.ui = $.ui || {}; $.ui = $.ui || {};


Expand Down Expand Up @@ -72,17 +69,21 @@ $.fn.extend({
return ( /fixed/ ).test( this.css( "position") ) || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; return ( /fixed/ ).test( this.css( "position") ) || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
}, },


uniqueId: function() { uniqueId: (function() {
return this.each(function() { var uuid = 0;
if ( !this.id ) {
this.id = "ui-id-" + (++uuid); return function() {
} return this.each(function() {
}); if ( !this.id ) {
}, this.id = "ui-id-" + ( ++uuid );
}
});
};
})(),


removeUniqueId: function() { removeUniqueId: function() {
return this.each(function() { return this.each(function() {
if ( runiqueId.test( this.id ) ) { if ( /^ui-id-\d+$/.test( this.id ) ) {
$( this ).removeAttr( "id" ); $( this ).removeAttr( "id" );
} }
}); });
Expand Down

0 comments on commit 9e6095a

Please sign in to comment.