Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Core: Move variables for .uniqueId()/.removeUniqueId() into their imp…

…lementations.
  • Loading branch information...
commit 9e6095a646f7e198a5ba29efd3efc36f010c23aa 1 parent 8a9fb52
@scottgonzalez scottgonzalez authored
Showing with 12 additions and 11 deletions.
  1. +12 −11 ui/jquery.ui.core.js
View
23 ui/jquery.ui.core.js
@@ -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" );
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.