Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#13332 closed bug (fixed)

.closest("*") yields input even for non-element nodes

Reported by: gibson042 Owned by:
Priority: high Milestone: 1.10/2.0
Component: traversing Version: 1.9.0
Keywords: Cc:
Blocked by: Blocking:



Ref. #13265.

.closest passes text/comment/etc. nodes directly to Sizzle, which assumes all input to be elements, so .closest("*") is erroneously an identity mapping.

Change History (6)

comment:1 Changed 9 years ago by dmethvin

Seems like it can easily be fixed, but I suspect it hasn't been reported because it's really rare to get into that situation. For events we make sure the event target is an element, and it would seem really rare for anyone to use .contents() or serialize HTML with top-level text nodes or and then use .closest().

comment:2 Changed 9 years ago by gibson042

Indeed. This is paired with #13265 in my mind, and they should either fix or wontfix together. A fix looks like https://github.com/jquery/jquery/pull/1146.

comment:3 Changed 9 years ago by Richard Gibson

Resolution: fixed
Status: newclosed

Fix #13265 #13332: Allow .parent/.closest with text nodes. Close gh-1146.

Changeset: 5e29ff7e59a0c97bae02b7512b40486df0f44022

comment:4 Changed 9 years ago by dmethvin

Component: unfiledtraversing
Milestone: None1.9.2
Priority: undecidedhigh

comment:5 Changed 9 years ago by Richard Gibson

Fix #13265 #13332: traversing methods with text nodes. Close gh-1145.

Changeset: b734666f4d2e9a92b8ebb99db5b05bd4c82e71f2

comment:16 Changed 8 years ago by dmethvin


Bulk update to milestone 1.10/2.0

Note: See TracTickets for help on using tickets.