#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: |
Description
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 10 years ago by
comment:2 Changed 10 years ago by
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 10 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fix #13265 #13332: Allow .parent/.closest with text nodes. Close gh-1146.
Changeset: 5e29ff7e59a0c97bae02b7512b40486df0f44022
comment:4 Changed 10 years ago by
Component: | unfiled → traversing |
---|---|
Milestone: | None → 1.9.2 |
Priority: | undecided → high |
comment:5 Changed 10 years ago by
Fix #13265 #13332: traversing methods with text nodes. Close gh-1145.
Changeset: b734666f4d2e9a92b8ebb99db5b05bd4c82e71f2
Note: See
TracTickets for help on using
tickets.
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()
.