File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -292,9 +292,9 @@ jQuery.extend({
292292 } ,
293293
294294 isEmptyObject : function ( obj ) {
295- var name = "" ;
296- for ( name in obj ) break ;
297- return ! name ;
295+ for ( var name in obj )
296+ return false ;
297+ return true ;
298298 } ,
299299
300300 // check if an element is in a (or is an) XML document
Original file line number Diff line number Diff line change @@ -599,3 +599,13 @@ test("jQuery.makeArray", function(){
599599
600600 ok ( jQuery . makeArray ( document . getElementById ( 'form' ) ) . length >= 13 , "Pass makeArray a form (treat as elements)" ) ;
601601} ) ;
602+
603+ test ( "jQuery.isEmptyObject" , function ( ) {
604+ expect ( 2 ) ;
605+
606+ equals ( true , jQuery . isEmptyObject ( { } ) , "isEmptyObject on empty object literal" ) ;
607+ equals ( false , jQuery . isEmptyObject ( { a :1 } ) , "isEmptyObject on non-empty object literal" ) ;
608+
609+ // What about this ?
610+ // equals(true, jQuery.isEmptyObject(null), "isEmptyObject on null" );
611+ } ) ;
You can’t perform that action at this time.
0 commit comments