Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core.js
Expand Up @@ -37,6 +37,10 @@ var
core_rnotwhite = /\S/, core_rnotwhite = /\S/,
core_rspace = /\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 // IE doesn't match non-breaking spaces with \s
rtrim = core_rnotwhite.test("\xA0") ? (/^[\s\xA0]+|[\s\xA0]+$/g) : /^\s+|\s+$/g, rtrim = core_rnotwhite.test("\xA0") ? (/^[\s\xA0]+|[\s\xA0]+$/g) : /^\s+|\s+$/g,


Expand Down
4 changes: 1 addition & 3 deletions src/data.js
Expand Up @@ -4,8 +4,6 @@ var rbrace = /^(?:\{.*\}|\[.*\])$/,
jQuery.extend({ jQuery.extend({
cache: {}, cache: {},


deletedIds: [],

// Please use with caution // Please use with caution
uuid: 0, uuid: 0,


Expand Down Expand Up @@ -58,7 +56,7 @@ jQuery.extend({
// Only DOM nodes need a new unique ID for each element since their data // Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache // ends up in the global cache
if ( isNode ) { if ( isNode ) {
elem[ internalKey ] = id = jQuery.deletedIds.pop() || ++jQuery.uuid; elem[ internalKey ] = id = core_deletedIds.pop() || ++jQuery.uuid;
} else { } else {
id = internalKey; id = internalKey;
} }
Expand Down
2 changes: 1 addition & 1 deletion src/manipulation.js
Expand Up @@ -821,7 +821,7 @@ jQuery.extend({
elem[ internalKey ] = null; elem[ internalKey ] = null;
} }


jQuery.deletedIds.push( id ); core_deletedIds.push( id );
} }
} }
} }
Expand Down