mirror of
https://github.com/jquery/jquery.git
synced 2026-02-01 23:45:06 -05:00
Build: update grunt-jscs-checker and pass with the new rules
This commit is contained in:
42
src/data.js
42
src/data.js
@@ -2,9 +2,9 @@ define([
|
||||
"./core",
|
||||
"./var/rnotwhite",
|
||||
"./core/access",
|
||||
"./data/var/data_priv",
|
||||
"./data/var/data_user"
|
||||
], function( jQuery, rnotwhite, access, data_priv, data_user ) {
|
||||
"./data/var/dataPriv",
|
||||
"./data/var/dataUser"
|
||||
], function( jQuery, rnotwhite, access, dataPriv, dataUser ) {
|
||||
|
||||
// Implementation Summary
|
||||
//
|
||||
@@ -37,10 +37,10 @@ function dataAttr( elem, key, data ) {
|
||||
+data + "" === data ? +data :
|
||||
rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
||||
data;
|
||||
} catch( e ) {}
|
||||
} catch ( e ) {}
|
||||
|
||||
// Make sure we set the data so it isn't changed later
|
||||
data_user.set( elem, key, data );
|
||||
dataUser.set( elem, key, data );
|
||||
} else {
|
||||
data = undefined;
|
||||
}
|
||||
@@ -50,25 +50,25 @@ function dataAttr( elem, key, data ) {
|
||||
|
||||
jQuery.extend({
|
||||
hasData: function( elem ) {
|
||||
return data_user.hasData( elem ) || data_priv.hasData( elem );
|
||||
return dataUser.hasData( elem ) || dataPriv.hasData( elem );
|
||||
},
|
||||
|
||||
data: function( elem, name, data ) {
|
||||
return data_user.access( elem, name, data );
|
||||
return dataUser.access( elem, name, data );
|
||||
},
|
||||
|
||||
removeData: function( elem, name ) {
|
||||
data_user.remove( elem, name );
|
||||
dataUser.remove( elem, name );
|
||||
},
|
||||
|
||||
// TODO: Now that all calls to _data and _removeData have been replaced
|
||||
// with direct calls to data_priv methods, these can be deprecated.
|
||||
// with direct calls to dataPriv methods, these can be deprecated.
|
||||
_data: function( elem, name, data ) {
|
||||
return data_priv.access( elem, name, data );
|
||||
return dataPriv.access( elem, name, data );
|
||||
},
|
||||
|
||||
_removeData: function( elem, name ) {
|
||||
data_priv.remove( elem, name );
|
||||
dataPriv.remove( elem, name );
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,9 +81,9 @@ jQuery.fn.extend({
|
||||
// Gets all values
|
||||
if ( key === undefined ) {
|
||||
if ( this.length ) {
|
||||
data = data_user.get( elem );
|
||||
data = dataUser.get( elem );
|
||||
|
||||
if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
|
||||
if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
|
||||
i = attrs.length;
|
||||
while ( i-- ) {
|
||||
|
||||
@@ -97,7 +97,7 @@ jQuery.fn.extend({
|
||||
}
|
||||
}
|
||||
}
|
||||
data_priv.set( elem, "hasDataAttrs", true );
|
||||
dataPriv.set( elem, "hasDataAttrs", true );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ jQuery.fn.extend({
|
||||
// Sets multiple values
|
||||
if ( typeof key === "object" ) {
|
||||
return this.each(function() {
|
||||
data_user.set( this, key );
|
||||
dataUser.set( this, key );
|
||||
});
|
||||
}
|
||||
|
||||
@@ -123,14 +123,14 @@ jQuery.fn.extend({
|
||||
if ( elem && value === undefined ) {
|
||||
// Attempt to get data from the cache
|
||||
// with the key as-is
|
||||
data = data_user.get( elem, key );
|
||||
data = dataUser.get( elem, key );
|
||||
if ( data !== undefined ) {
|
||||
return data;
|
||||
}
|
||||
|
||||
// Attempt to get data from the cache
|
||||
// with the key camelized
|
||||
data = data_user.get( elem, camelKey );
|
||||
data = dataUser.get( elem, camelKey );
|
||||
if ( data !== undefined ) {
|
||||
return data;
|
||||
}
|
||||
@@ -150,18 +150,18 @@ jQuery.fn.extend({
|
||||
this.each(function() {
|
||||
// First, attempt to store a copy or reference of any
|
||||
// data that might've been store with a camelCased key.
|
||||
var data = data_user.get( this, camelKey );
|
||||
var data = dataUser.get( this, camelKey );
|
||||
|
||||
// For HTML5 data-* attribute interop, we have to
|
||||
// store property names with dashes in a camelCase form.
|
||||
// This might not apply to all properties...*
|
||||
data_user.set( this, camelKey, value );
|
||||
dataUser.set( this, camelKey, value );
|
||||
|
||||
// *... In the case of properties that might _actually_
|
||||
// have dashes, we need to also store a copy of that
|
||||
// unchanged property.
|
||||
if ( key.indexOf("-") !== -1 && data !== undefined ) {
|
||||
data_user.set( this, key, value );
|
||||
dataUser.set( this, key, value );
|
||||
}
|
||||
});
|
||||
}, null, value, arguments.length > 1, null, true );
|
||||
@@ -169,7 +169,7 @@ jQuery.fn.extend({
|
||||
|
||||
removeData: function( key ) {
|
||||
return this.each(function() {
|
||||
data_user.remove( this, key );
|
||||
dataUser.remove( this, key );
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user