-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parent() may fail in functions #1637
Conversation
This reminds me, shouldn't everything run in strict mode? |
Nice find! Happy to merge this, just out of curiosity: Is this actually a fix, or just a short-circuit for an empty input? |
What do you mean ? |
b76421d
to
173a9c2
Compare
What I was trying to get at was does this actually produce an error? And yes, it does: $('<a>').parent(undefined)
// => Uncaught TypeError: Cannot read property 'cheerio' of undefined Could you add a test case that covers this? |
Awesome, thanks! |
parent() don't work well in functions if selector is undefined
In .parent() has condition:
but it will fail if used like in function above, since
arguments.length
will be 1 even whenselector
is actually undefined.