fixed offset(coordinates) returns null when no matching elements in jQuery object (fixes ticket #5888)

This commit is contained in:
Karl Swedberg 2010-01-21 23:18:54 +08:00 committed by John Resig
parent a63754aa4e
commit 2c28f229e5
3 changed files with 16 additions and 10 deletions

View file

@ -305,6 +305,13 @@ testoffset("body", function( jQuery ) {
equals( jQuery('body').offset().left, 1, "jQuery('#body').offset().left" );
});
test("Chaining offset(coords) returns jQuery object", function() {
expect(2);
var coords = { top: 1, left: 1 };
equals( jQuery("#absolute-1").offset(coords).selector, "#absolute-1", "offset(coords) returns jQuery object" );
equals( jQuery("#non-existent").offset(coords).selector, "#non-existent", "offset(coords) with empty jQuery set returns jQuery object" );
});
test("offsetParent", function(){
expect(11);