git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Delay the result of the readyState check to give scripts the opportunity to delay...
[jquery.git]
/
src
/
data.js
diff --git
a/src/data.js
b/src/data.js
index
cf3cf60
..
ac082dd
100644
(file)
--- a/
src/data.js
+++ b/
src/data.js
@@
-1,7
+1,8
@@
(function( jQuery ) {
var windowData = {},
(function( jQuery ) {
var windowData = {},
- rbrace = /^(?:\{.*\}|\[.*\])$/;
+ rbrace = /^(?:\{.*\}|\[.*\])$/,
+ rdigit = /\d/;
jQuery.extend({
cache: {},
jQuery.extend({
cache: {},
@@
-51,9
+52,10
@@
jQuery.extend({
// want to manipulate it.
if ( typeof name === "object" ) {
if ( isNode ) {
// want to manipulate it.
if ( typeof name === "object" ) {
if ( isNode ) {
- cache[ id ] = jQuery.extend(true, {}, name);
+ cache[ id ] = jQuery.extend(cache[ id ], name);
+
} else {
} else {
- store = jQuery.extend(true, {}, name);
+ store = jQuery.extend(cache[ id ], name);
cache[ id ] = function() {
return store;
};
cache[ id ] = function() {
return store;
};
@@
-62,6
+64,7
@@
jQuery.extend({
} else if ( !cache[ id ] ) {
if ( isNode ) {
cache[ id ] = {};
} else if ( !cache[ id ] ) {
if ( isNode ) {
cache[ id ] = {};
+
} else {
store = {};
cache[ id ] = function() {
} else {
store = {};
cache[ id ] = function() {
@@
-128,8
+131,8
@@
jQuery.extend({
jQuery.fn.extend({
data: function( key, value ) {
jQuery.fn.extend({
data: function( key, value ) {
- if ( typeof key === "undefined" && this.length ) {
- return jQuery.data( this[0] );
+ if ( typeof key === "undefined" ) {
+ return this.length ? jQuery.data( this[0] ) : null;
} else if ( typeof key === "object" ) {
return this.each(function() {
} else if ( typeof key === "object" ) {
return this.each(function() {
@@
-157,7
+160,7
@@
jQuery.fn.extend({
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
- !isNaN( data ) ? parseFloat( data ) :
+ rdigit.test( data ) && !isNaN( data ) ? parseFloat( data ) :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}