Skip to main content

Bug Tracker

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: Owned by: timmywil
Priority: low Milestone: 1.7
Component: selector Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:

$(window).is("a") throws a uncaught exception

Attachments (0)
Change History (4)

Changed August 31, 2011 01:54PM UTC by timmywil comment:1

component: unfiledtraversing
priority: undecidedlow

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.

Changed August 31, 2011 02:12PM UTC by timmywil comment:2

component: traversingselector
milestone: None1.7
owner: → timmywil
status: newassigned

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 anonymous 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.

Changed September 19, 2011 07:43PM UTC by timmywil comment:4

resolution: → fixed
status: assignedclosed

Override Sizzle attribute retrieval with jQuery.attr. Fixes #5637, #7128, #9261, #9570, #10178.

Bug fixed on the side: $(window).is('a') was throwing an exception. Fixes #10178.

Changeset: 92405d4f5ffe9ec1f26f280303783014948438c5