aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2013-10-23 08:17:21 -0400
committerScott González <scott.gonzalez@gmail.com>2013-10-24 09:19:42 -0400
commit9e6095a646f7e198a5ba29efd3efc36f010c23aa (patch)
treecf9c32eba1852d6ba513e603863eac3218c1f78e
parent8a9fb528225824622e23be45a401fbc025ee3786 (diff)
downloadjquery-ui-9e6095a646f7e198a5ba29efd3efc36f010c23aa.tar.gz
jquery-ui-9e6095a646f7e198a5ba29efd3efc36f010c23aa.zip
Core: Move variables for .uniqueId()/.removeUniqueId() into their implementations.
-rw-r--r--ui/jquery.ui.core.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js
index 9145d5d45..7faae0760 100644
--- a/ui/jquery.ui.core.js
+++ b/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" );
}
});