aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/attributes.js4
-rw-r--r--src/css.js6
-rw-r--r--src/data.js9
-rw-r--r--src/effects.js11
-rw-r--r--src/event.js9
-rw-r--r--src/manipulation.js9
-rw-r--r--src/queue.js13
7 files changed, 26 insertions, 35 deletions
diff --git a/src/attributes.js b/src/attributes.js
index c44590427..b68f773d8 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -131,14 +131,14 @@ jQuery.fn.extend({
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
// store className if set
- jQuery._data( this, "__className__", this.className );
+ data_priv.set( this, "__className__", this.className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
}
});
},
diff --git a/src/css.js b/src/css.js
index bbd56ad7b..2616572a7 100644
--- a/src/css.js
+++ b/src/css.js
@@ -65,7 +65,7 @@ function showHide( elements, show ) {
continue;
}
- values[ index ] = jQuery._data( elem, "olddisplay" );
+ values[ index ] = data_priv.get( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
@@ -78,7 +78,7 @@ function showHide( elements, show ) {
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
- values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+ values[ index ] = data_priv.access( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
@@ -86,7 +86,7 @@ function showHide( elements, show ) {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
- jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+ data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css(elem, "display") );
}
}
}
diff --git a/src/data.js b/src/data.js
index f5d3d178a..45d6ed052 100644
--- a/src/data.js
+++ b/src/data.js
@@ -183,15 +183,6 @@ Data.prototype = {
}
};
-// This will be used by remove()/cleanData() in manipulation to sever
-// remaining references to node objects. One day we'll replace the dual
-// arrays with a WeakMap and this won't be an issue.
-// (Splices the data objects out of the internal cache arrays)
-function data_discard( owner ) {
- data_user.discard( owner );
- data_priv.discard( owner );
-}
-
// These may be used throughout the jQuery core codebase
data_user = new Data();
data_priv = new Data();
diff --git a/src/effects.js b/src/effects.js
index 8a2f2a26c..7f54dd56e 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -318,7 +318,7 @@ function defaultPrefilter( elem, props, opts ) {
length = handled.length;
if ( length ) {
- dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
+ dataShow = data_priv.get( elem, "fxshow" ) || data_priv.access( elem, "fxshow", {} );
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
@@ -336,7 +336,8 @@ function defaultPrefilter( elem, props, opts ) {
}
anim.done(function() {
var prop;
- jQuery._removeData( elem, "fxshow" );
+
+ data_priv.remove( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
@@ -479,7 +480,7 @@ jQuery.fn.extend({
anim.stop( true );
};
// Empty animations, or finishing resolves immediately
- if ( empty || jQuery._data( this, "finish" ) ) {
+ if ( empty || data_priv.get( this, "finish" ) ) {
anim.stop( true );
}
};
@@ -509,7 +510,7 @@ jQuery.fn.extend({
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
- data = jQuery._data( this );
+ data = data_priv.get( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
@@ -545,7 +546,7 @@ jQuery.fn.extend({
}
return this.each(function() {
var index,
- data = jQuery._data( this ),
+ data = data_priv.get( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
diff --git a/src/event.js b/src/event.js
index 961e580b4..2c9b55514 100644
--- a/src/event.js
+++ b/src/event.js
@@ -196,10 +196,7 @@ jQuery.event = {
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
-
- // removeData also checks for emptiness and clears the expando if empty
- // so use it instead of delete
- jQuery._removeData( elem, "events" );
+ data_priv.remove( elem, "events" );
}
},
@@ -287,7 +284,7 @@ jQuery.event = {
special.bindType || type;
// jQuery handler
- handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
@@ -340,7 +337,7 @@ jQuery.event = {
var i, j, ret, matched, handleObj,
handlerQueue = [],
args = core_slice.call( arguments ),
- handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
+ handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
diff --git a/src/manipulation.js b/src/manipulation.js
index 8f0422694..c794470dc 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -442,7 +442,7 @@ jQuery.extend({
return fragment;
},
- cleanData: function( elems, /* internal */ acceptData ) {
+ cleanData: function( elems ) {
var data, elem, type,
l = elems.length,
i = 0,
@@ -451,7 +451,7 @@ jQuery.extend({
for ( ; i < l; i++ ) {
elem = elems[ i ];
- if ( acceptData || jQuery.acceptData( elem ) ) {
+ if ( jQuery.acceptData( elem ) ) {
data = data_priv.access( elem );
@@ -468,7 +468,10 @@ jQuery.extend({
}
}
// Discard any remaining `private` and `user` data
- data_discard( elem );
+ // One day we'll replace the dual arrays with a WeakMap and this won't be an issue.
+ // (Splices the data objects out of the internal cache arrays)
+ data_user.discard( elem );
+ data_priv.discard( elem );
}
}
});
diff --git a/src/queue.js b/src/queue.js
index d4c3f0040..46b9ba8fc 100644
--- a/src/queue.js
+++ b/src/queue.js
@@ -4,12 +4,12 @@ jQuery.extend({
if ( elem ) {
type = ( type || "fx" ) + "queue";
- queue = jQuery._data( elem, type );
+ queue = data_priv.get( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
- if ( !queue || jQuery.isArray(data) ) {
- queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ if ( !queue || jQuery.isArray( data ) ) {
+ queue = data_priv.access( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
@@ -57,10 +57,9 @@ jQuery.extend({
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
- return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+ return data_priv.get( elem, key ) || data_priv.access( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
- jQuery._removeData( elem, type + "queue" );
- jQuery._removeData( elem, key );
+ data_priv.remove( elem, [ type + "queue", key ] );
})
});
}
@@ -135,7 +134,7 @@ jQuery.fn.extend({
type = type || "fx";
while( i-- ) {
- tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ tmp = data_priv.get( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );