mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Data: shave off a couple of bytes
Closes gh-1931
This commit is contained in:
parent
72c4a067a9
commit
6f65f5faf2
@ -1,10 +1,9 @@
|
|||||||
define([
|
define([
|
||||||
"./core",
|
"./core",
|
||||||
"./var/rnotwhite",
|
|
||||||
"./core/access",
|
"./core/access",
|
||||||
"./data/var/dataPriv",
|
"./data/var/dataPriv",
|
||||||
"./data/var/dataUser"
|
"./data/var/dataUser"
|
||||||
], function( jQuery, rnotwhite, access, dataPriv, dataUser ) {
|
], function( jQuery, access, dataPriv, dataUser ) {
|
||||||
|
|
||||||
// Implementation Summary
|
// Implementation Summary
|
||||||
//
|
//
|
||||||
@ -17,7 +16,7 @@ define([
|
|||||||
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
|
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
|
||||||
|
|
||||||
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
|
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
|
||||||
rmultiDash = /([A-Z])/g;
|
rmultiDash = /[A-Z]/g;
|
||||||
|
|
||||||
function dataAttr( elem, key, data ) {
|
function dataAttr( elem, key, data ) {
|
||||||
var name;
|
var name;
|
||||||
@ -25,7 +24,7 @@ function dataAttr( elem, key, data ) {
|
|||||||
// If nothing was found internally, try to fetch any
|
// If nothing was found internally, try to fetch any
|
||||||
// data from the HTML5 data-* attribute
|
// data from the HTML5 data-* attribute
|
||||||
if ( data === undefined && elem.nodeType === 1 ) {
|
if ( data === undefined && elem.nodeType === 1 ) {
|
||||||
name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
|
name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
|
||||||
data = elem.getAttribute( name );
|
data = elem.getAttribute( name );
|
||||||
|
|
||||||
if ( typeof data === "string" ) {
|
if ( typeof data === "string" ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user