Only perpetrate the .toJSON hack on data caches when they are attached to a plain Javascript object. Part of the continuing saga of #8108.
This commit is contained in:
parent
5b38439011
commit
b9f5e2b974
2 changed files with 10 additions and 7 deletions
11
src/data.js
11
src/data.js
|
@ -68,7 +68,9 @@ jQuery.extend({
|
|||
// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
|
||||
// metadata on plain JS objects when the object is serialized using
|
||||
// JSON.stringify
|
||||
cache[ id ].toJSON = jQuery.noop;
|
||||
if ( !isNode ) {
|
||||
cache[ id ].toJSON = jQuery.noop;
|
||||
}
|
||||
}
|
||||
|
||||
// An object can be passed to jQuery.data instead of a key/value pair; this gets
|
||||
|
@ -168,6 +170,13 @@ jQuery.extend({
|
|||
// data if it existed
|
||||
if ( internalCache ) {
|
||||
cache[ id ] = {};
|
||||
// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
|
||||
// metadata on plain JS objects when the object is serialized using
|
||||
// JSON.stringify
|
||||
if ( !isNode ) {
|
||||
cache[ id ].toJSON = jQuery.noop;
|
||||
}
|
||||
|
||||
cache[ id ][ internalKey ] = internalCache;
|
||||
|
||||
// Otherwise, we need to eliminate the expando on the node to avoid
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue