mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Build: Update jscs and lint files
Fixes gh-2056
This commit is contained in:
27
src/data.js
27
src/data.js
@@ -1,4 +1,4 @@
|
||||
define([
|
||||
define( [
|
||||
"./core",
|
||||
"./core/access",
|
||||
"./data/var/dataPriv",
|
||||
@@ -32,6 +32,7 @@ function dataAttr( elem, key, data ) {
|
||||
data = data === "true" ? true :
|
||||
data === "false" ? false :
|
||||
data === "null" ? null :
|
||||
|
||||
// Only convert to a number if it doesn't change the string
|
||||
+data + "" === data ? +data :
|
||||
rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
||||
@@ -47,7 +48,7 @@ function dataAttr( elem, key, data ) {
|
||||
return data;
|
||||
}
|
||||
|
||||
jQuery.extend({
|
||||
jQuery.extend( {
|
||||
hasData: function( elem ) {
|
||||
return dataUser.hasData( elem ) || dataPriv.hasData( elem );
|
||||
},
|
||||
@@ -69,9 +70,9 @@ jQuery.extend({
|
||||
_removeData: function( elem, name ) {
|
||||
dataPriv.remove( elem, name );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
jQuery.fn.extend({
|
||||
jQuery.fn.extend( {
|
||||
data: function( key, value ) {
|
||||
var i, name, data,
|
||||
elem = this[ 0 ],
|
||||
@@ -91,7 +92,7 @@ jQuery.fn.extend({
|
||||
if ( attrs[ i ] ) {
|
||||
name = attrs[ i ].name;
|
||||
if ( name.indexOf( "data-" ) === 0 ) {
|
||||
name = jQuery.camelCase( name.slice(5) );
|
||||
name = jQuery.camelCase( name.slice( 5 ) );
|
||||
dataAttr( elem, name, data[ name ] );
|
||||
}
|
||||
}
|
||||
@@ -105,9 +106,9 @@ jQuery.fn.extend({
|
||||
|
||||
// Sets multiple values
|
||||
if ( typeof key === "object" ) {
|
||||
return this.each(function() {
|
||||
return this.each( function() {
|
||||
dataUser.set( this, key );
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
return access( this, function( value ) {
|
||||
@@ -139,20 +140,20 @@ jQuery.fn.extend({
|
||||
}
|
||||
|
||||
// Set the data...
|
||||
this.each(function() {
|
||||
this.each( function() {
|
||||
|
||||
// We always store the camelCased key
|
||||
dataUser.set( this, key, value );
|
||||
});
|
||||
} );
|
||||
}, null, value, arguments.length > 1, null, true );
|
||||
},
|
||||
|
||||
removeData: function( key ) {
|
||||
return this.each(function() {
|
||||
return this.each( function() {
|
||||
dataUser.remove( this, key );
|
||||
});
|
||||
} );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
return jQuery;
|
||||
});
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user