Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#10178 closed bug (fixed)

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

Reported by: ronny@… 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

Change History (4)

comment:1 Changed 5 years ago by timmywil

  • Component changed from unfiled to traversing
  • Priority changed from undecided to low

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 5 years ago by timmywil

  • Component changed from traversing to selector
  • Milestone changed from None to 1.7
  • Owner set to timmywil
  • Status changed from new to 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.

comment:3 Changed 5 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 5 years ago by timmywil

  • Resolution set to fixed
  • Status changed from assigned to closed

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.