Test case for jQuery Ticket 7995

binding to object with a length property

by rwaldron

JavaScript

var ok1 = { foo: 2 },
    ok2 = { length: null },
    ok3 = { length: undefined },
    err = { length: 3 };

console.log( $( ok1 ).length ); //1 OK
console.log( $( ok2 ).length ); //1 OK
console.log( $( ok3 ).length ); //1 OK
console.log( $( err ).length ); //3 WTF!

// the execption  is just a side-effect
/*
try  {
    $( err ).bind( "joe", jQuery.noop );
} catch( e ) {
    console.log( "oops" );
    console && console.log( e );
}
*/