Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#10178 closed bug (fixed)

$(window).is("a") >> Uncaught TypeError: Cannot call method 'toLowerCase' of undefined

Reported by: ronny@… Owned by: Timmy Willison
Priority: low Milestone: 1.7
Component: selector Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:

Description

http://jsfiddle.net/k4nz6/

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

Change History (4)

comment:1 Changed 12 years ago by Timmy Willison

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.

comment:2 Changed 12 years ago by Timmy Willison

Component: traversingselector
Milestone: None1.7
Owner: set to Timmy Willison
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.

comment:3 Changed 12 years ago by anonymous

Easy fix, l.4352 should be:

-return (match === "*" && elem.nodeType === 1) +return (match === "*" && elem.nodeType === 1)
elem.nodeName.toLowerCase() === match;
(elem.nodeName && elem.nodeName.toLowerCase() === match);

It was broken for elements which does not have a "nodeName" property.

comment:4 Changed 12 years ago by Timmy Willison

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

Note: See TracTickets for help on using tickets.