mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Core: Move variables for .uniqueId()/.removeUniqueId() into their implementations.
This commit is contained in:
parent
8a9fb52822
commit
9e6095a646
23
ui/jquery.ui.core.js
vendored
23
ui/jquery.ui.core.js
vendored
@ -10,9 +10,6 @@
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
var uuid = 0,
|
||||
runiqueId = /^ui-id-\d+$/;
|
||||
|
||||
// $.ui might exist from components with no dependencies, e.g., $.ui.position
|
||||
$.ui = $.ui || {};
|
||||
|
||||
@ -72,17 +69,21 @@ $.fn.extend({
|
||||
return ( /fixed/ ).test( this.css( "position") ) || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
|
||||
},
|
||||
|
||||
uniqueId: function() {
|
||||
return this.each(function() {
|
||||
if ( !this.id ) {
|
||||
this.id = "ui-id-" + (++uuid);
|
||||
}
|
||||
});
|
||||
},
|
||||
uniqueId: (function() {
|
||||
var uuid = 0;
|
||||
|
||||
return function() {
|
||||
return this.each(function() {
|
||||
if ( !this.id ) {
|
||||
this.id = "ui-id-" + ( ++uuid );
|
||||
}
|
||||
});
|
||||
};
|
||||
})(),
|
||||
|
||||
removeUniqueId: function() {
|
||||
return this.each(function() {
|
||||
if ( runiqueId.test( this.id ) ) {
|
||||
if ( /^ui-id-\d+$/.test( this.id ) ) {
|
||||
$( this ).removeAttr( "id" );
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user