@@ -14,34 +14,23 @@ Data.accepts = jQuery.acceptData;
1414Data . prototype = {
1515
1616 register : function ( owner , initial ) {
17- var descriptor = { } ,
18- value = initial || { } ;
19-
20- try {
21- // If it is a node unlikely to be stringify-ed or looped over
22- // use plain assignment
23- if ( owner . nodeType ) {
24- owner [ this . expando ] = value ;
25-
26- // Otherwise secure it in a non-enumerable, non-writable property
27- // configurability must be true to allow the property to be
28- // deleted with the delete operator
29- } else {
30- descriptor [ this . expando ] = {
31- value : value ,
32- writable : true ,
33- configurable : true
34- } ;
35- Object . defineProperties ( owner , descriptor ) ;
36- }
17+ var value = initial || { } ;
3718
38- // Support: Android < 4
39- // Fallback to a less secure definition
40- } catch ( e ) {
41- descriptor [ this . expando ] = value ;
42- jQuery . extend ( owner , descriptor ) ;
43- }
19+ // If it is a node unlikely to be stringify-ed or looped over
20+ // use plain assignment
21+ if ( owner . nodeType ) {
22+ owner [ this . expando ] = value ;
4423
24+ // Otherwise secure it in a non-enumerable, non-writable property
25+ // configurability must be true to allow the property to be
26+ // deleted with the delete operator
27+ } else {
28+ Object . defineProperty ( owner , this . expando , {
29+ value : value ,
30+ writable : true ,
31+ configurable : true
32+ } ) ;
33+ }
4534 return owner [ this . expando ] ;
4635 } ,
4736 cache : function ( owner , initial ) {
@@ -73,15 +62,9 @@ Data.prototype = {
7362
7463 // Handle: [ owner, { properties } ] args
7564 } else {
76- // Fresh assignments by object are shallow copied
77- if ( jQuery . isEmptyObject ( cache ) ) {
78-
79- jQuery . extend ( cache , data ) ;
80- // Otherwise, copy the properties one-by-one to the cache object
81- } else {
82- for ( prop in data ) {
83- cache [ prop ] = data [ prop ] ;
84- }
65+ // Copy the properties one-by-one to the cache object
66+ for ( prop in data ) {
67+ cache [ prop ] = data [ prop ] ;
8568 }
8669 }
8770 return cache ;
@@ -128,7 +111,11 @@ Data.prototype = {
128111 } ,
129112 remove : function ( owner , key ) {
130113 var i , name , camel ,
131- cache = this . cache ( owner ) ;
114+ cache = owner [ this . expando ] ;
115+
116+ if ( cache === undefined ) {
117+ return ;
118+ }
132119
133120 if ( key === undefined ) {
134121 this . register ( owner ) ;
0 commit comments