Side navigation
#10178 closed bug (fixed)
Opened August 31, 2011 01:30PM UTC
Closed September 19, 2011 07:43PM UTC
Last modified March 08, 2012 11:17PM UTC
$(window).is("a") >> Uncaught TypeError: Cannot call method 'toLowerCase' of undefined
Reported by: | ronny@11lein.de | Owned by: | timmywil |
---|---|---|---|
Priority: | low | Milestone: | 1.7 |
Component: | selector | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
$(window).is("a") throws a uncaught exception
Attachments (0)
Change History (4)
Changed August 31, 2011 01:54PM UTC by comment:1
component: | unfiled → traversing |
---|---|
priority: | undecided → low |
Changed August 31, 2011 02:12PM UTC by comment:2
component: | traversing → selector |
---|---|
milestone: | None → 1.7 |
owner: | → timmywil |
status: | new → assigned |
Spoke to rwaldron. This is probably easy enough to fix and I can think of at least one case where it would be nice to have this fail silently. That is, if window is part of a larger set and the set is being filtered. Assigning to myself as this is an issue in sizzle.
Changed September 16, 2011 11:44PM UTC by comment:3
Easy fix, l.4352 should be:
-return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
+return (match === "*" && elem.nodeType === 1) || (elem.nodeName && elem.nodeName.toLowerCase() === match);
It was broken for elements which does not have a "nodeName" property.
I'm inclined to say don't call .is() on a window. There isn't really a useful result that can be given in this case since windows cannot be selected with a selector. I'll let someone else on the team weigh in before closing.