Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Replace unnecessarily exposed jQuery.deletedIds array with private array (No ticket) #889

Closed
wants to merge 1 commit into from

1 participant

@rwaldron
Collaborator

Motivated by @gibson042 #887

Sizes - compared to master
    258583       (+89)  dist/jquery.js                                         
     92532       (-28)  dist/jquery.min.js                                     
     33101        (-4)  dist/jquery.min.js.gz         

Signed-off-by: Rick Waldron waldron.rick@gmail.com

@rwaldron rwaldron Replace unnecessarily exposed jQuery.deletedIds array with private ar…
…ray. (No ticket)

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
c0dc85f
@rwaldron rwaldron closed this in 8076a33
@mescoda mescoda referenced this pull request from a commit in mescoda/jquery
@rwaldron rwaldron Don't expose jQuery.deletedIds. Close gh-889. 6ea0a3f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 9, 2012
  1. @rwaldron

    Replace unnecessarily exposed jQuery.deletedIds array with private ar…

    rwaldron authored
    …ray. (No ticket)
    
    Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 4 deletions.
  1. +4 −0 src/core.js
  2. +1 −3 src/data.js
  3. +1 −1  src/manipulation.js
View
4 src/core.js
@@ -37,6 +37,10 @@ var
core_rnotwhite = /\S/,
core_rspace = /\s+/,
+ // Used in data, manipulation to track and reuse
+ // cache ids that have been deleted
+ core_deletedIds = [],
+
// IE doesn't match non-breaking spaces with \s
rtrim = core_rnotwhite.test("\xA0") ? (/^[\s\xA0]+|[\s\xA0]+$/g) : /^\s+|\s+$/g,
View
4 src/data.js
@@ -4,8 +4,6 @@ var rbrace = /^(?:\{.*\}|\[.*\])$/,
jQuery.extend({
cache: {},
- deletedIds: [],
-
// Please use with caution
uuid: 0,
@@ -58,7 +56,7 @@ jQuery.extend({
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
- elem[ internalKey ] = id = jQuery.deletedIds.pop() || ++jQuery.uuid;
+ elem[ internalKey ] = id = core_deletedIds.pop() || ++jQuery.uuid;
} else {
id = internalKey;
}
View
2  src/manipulation.js
@@ -821,7 +821,7 @@ jQuery.extend({
elem[ internalKey ] = null;
}
- jQuery.deletedIds.push( id );
+ core_deletedIds.push( id );
}
}
}
Something went wrong with that request. Please try again.