Skip to content

Commit

Permalink
Merge branch 'main' into test/lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Jan 4, 2021
2 parents ec58a93 + 43592d6 commit b65a740
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api/traversing.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ exports.parent = function (selector) {
}
});

if (arguments.length) {
if (selector) {
set = exports.filter.call(set, selector, this);
}

Expand Down
6 changes: 6 additions & 0 deletions test/api/traversing.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,12 @@ describe('$(...)', function () {
expect(result[1].attribs.id).toBe('vegetables');
});

it('(undefined) : should not throw an exception', function () {
expect(function () {
$('li').parent(undefined);
}).not.toThrow();
});

it('() : should return an empty object for top-level elements', function () {
var result = $('html').parent();
expect(result).toHaveLength(0);
Expand Down

0 comments on commit b65a740

Please sign in to comment.