mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Merge pull request #456 from rwldrn/9318
Improves support for arbitrary numbers in data keys. Fixes #9318
This commit is contained in:
commit
b22c904652
@ -46,11 +46,11 @@ var jQuery = function( selector, context ) {
|
|||||||
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
|
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
|
||||||
|
|
||||||
// Matches dashed string for camelizing
|
// Matches dashed string for camelizing
|
||||||
rdashAlpha = /-([a-z])/ig,
|
rdashAlpha = /-([a-z]|[0-9])/ig,
|
||||||
|
|
||||||
// Used by jQuery.camelCase as callback to replace()
|
// Used by jQuery.camelCase as callback to replace()
|
||||||
fcamelCase = function( all, letter ) {
|
fcamelCase = function( all, letter ) {
|
||||||
return letter.toUpperCase();
|
return ( letter + "" ).toUpperCase();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Keep a UserAgent string for use with jQuery.browser
|
// Keep a UserAgent string for use with jQuery.browser
|
||||||
|
@ -538,10 +538,13 @@ test("jQuery.data supports interoperable hyphenated/camelCase get/set of propert
|
|||||||
"an-object": {},
|
"an-object": {},
|
||||||
"bool-true": true,
|
"bool-true": true,
|
||||||
"bool-false": false,
|
"bool-false": false,
|
||||||
"some-json": '{ "foo": "bar" }'
|
"some-json": '{ "foo": "bar" }',
|
||||||
|
"num-1-middle": true,
|
||||||
|
"num-end-2": true,
|
||||||
|
"2-num-start": true
|
||||||
};
|
};
|
||||||
|
|
||||||
expect( 18 );
|
expect( 24 );
|
||||||
|
|
||||||
jQuery.each( datas, function( key, val ) {
|
jQuery.each( datas, function( key, val ) {
|
||||||
div.data( key, val );
|
div.data( key, val );
|
||||||
@ -578,4 +581,4 @@ test("jQuery.data supports interoperable removal of hyphenated/camelCase propert
|
|||||||
equal( div.data( key ), undefined, "get: " + key );
|
equal( div.data( key ), undefined, "get: " + key );
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user