@@ -84,7 +84,7 @@ var jqCache = {},
84
84
? function ( element , type , fn ) { element . removeEventListener ( type , fn , false ) ; }
85
85
: function ( element , type , fn ) { element . detachEvent ( 'on' + type , fn ) ; } ) ;
86
86
87
- function jqNextId ( ) { return ( jqId ++ ) ; }
87
+ function jqNextId ( ) { return ++ jqId ; }
88
88
89
89
90
90
var SPECIAL_CHARS_REGEXP = / ( [ \: \- \_ ] + ( .) ) / g;
@@ -187,7 +187,8 @@ function JQLiteDealoc(element){
187
187
188
188
function JQLiteRemoveData ( element ) {
189
189
var cacheId = element [ jqName ] ,
190
- cache = jqCache [ cacheId ] ;
190
+ cache = jqCache [ cacheId ] ;
191
+
191
192
if ( cache ) {
192
193
if ( cache . bind ) {
193
194
forEach ( cache . bind , function ( fn , type ) {
@@ -206,6 +207,7 @@ function JQLiteRemoveData(element) {
206
207
function JQLiteData ( element , key , value ) {
207
208
var cacheId = element [ jqName ] ,
208
209
cache = jqCache [ cacheId || - 1 ] ;
210
+
209
211
if ( isDefined ( value ) ) {
210
212
if ( ! cache ) {
211
213
element [ jqName ] = cacheId = jqNextId ( ) ;
@@ -452,10 +454,16 @@ forEach({
452
454
// in a way that survives minification.
453
455
if ( ( ( fn . length == 2 && ( fn !== JQLiteHasClass && fn !== JQLiteController ) ) ? arg1 : arg2 ) === undefined ) {
454
456
if ( isObject ( arg1 ) ) {
457
+
455
458
// we are a write, but the object properties are the key/values
456
459
for ( i = 0 ; i < this . length ; i ++ ) {
457
- for ( key in arg1 ) {
458
- fn ( this [ i ] , key , arg1 [ key ] ) ;
460
+ if ( fn === JQLiteData ) {
461
+ // data() takes the whole object in jQuery
462
+ fn ( this [ i ] , arg1 ) ;
463
+ } else {
464
+ for ( key in arg1 ) {
465
+ fn ( this [ i ] , key , arg1 [ key ] ) ;
466
+ }
459
467
}
460
468
}
461
469
// return self for chaining
0 commit comments