Test case for jQuery Ticket 7995
binding to object with a length property
by jitter
JavaScript
var ok1 = { foo: 2 },
ok2 = { length: null },
ok3 = { length: undefined },
err = { length: 3 };
alert( $( ok1 ).length ); //1 OK
alert( $( ok2 ).length ); //1 OK
alert( $( ok3 ).length ); //1 OK
alert( $( err ).length ); //3 WTF!
// the execption is just a side-effect
/*
try {
$( err ).bind( "joe", jQuery.noop );
} catch( e ) {
alert( "oops" );
console && console.log( e );
}
*/