mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Minor updates. All parameters of an internal function are for internal use only.
This commit is contained in:
parent
1e1ea2c44f
commit
2a70774036
22
src/data.js
22
src/data.js
@ -1,7 +1,7 @@
|
|||||||
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
|
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
|
||||||
rmultiDash = /([A-Z])/g;
|
rmultiDash = /([A-Z])/g;
|
||||||
|
|
||||||
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
|
function internalData( elem, name, data, pvt ) {
|
||||||
if ( !jQuery.acceptData( elem ) ) {
|
if ( !jQuery.acceptData( elem ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ){
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function internalRemoveData( elem, name, pvt /* For internal use only */ ){
|
function internalRemoveData( elem, name, pvt ) {
|
||||||
if ( !jQuery.acceptData( elem ) ) {
|
if ( !jQuery.acceptData( elem ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -205,11 +205,11 @@ jQuery.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
data: function( elem, name, data ) {
|
data: function( elem, name, data ) {
|
||||||
return internalData( elem, name, data, false );
|
return internalData( elem, name, data );
|
||||||
},
|
},
|
||||||
|
|
||||||
removeData: function( elem, name ) {
|
removeData: function( elem, name ) {
|
||||||
return internalRemoveData( elem, name, false );
|
return internalRemoveData( elem, name );
|
||||||
},
|
},
|
||||||
|
|
||||||
// For internal use only.
|
// For internal use only.
|
||||||
@ -304,12 +304,12 @@ function dataAttr( elem, key, data ) {
|
|||||||
if ( typeof data === "string" ) {
|
if ( typeof data === "string" ) {
|
||||||
try {
|
try {
|
||||||
data = data === "true" ? true :
|
data = data === "true" ? true :
|
||||||
data === "false" ? false :
|
data === "false" ? false :
|
||||||
data === "null" ? null :
|
data === "null" ? null :
|
||||||
// Only convert to a number if it doesn't change the string
|
// Only convert to a number if it doesn't change the string
|
||||||
+data + "" === data ? +data :
|
+data + "" === data ? +data :
|
||||||
rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
||||||
data;
|
data;
|
||||||
} catch( e ) {}
|
} catch( e ) {}
|
||||||
|
|
||||||
// Make sure we set the data so it isn't changed later
|
// Make sure we set the data so it isn't changed later
|
||||||
|
Loading…
Reference in New Issue
Block a user