Bug Tracker

Modify

Ticket #4539 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

live with context in jquery nightly

Reported by: trixi Owned by: brandon
Priority: major Milestone: 1.4
Component: event Version: 1.3.2
Keywords: Cc:
Blocking: Blocked by:

Description

You have added support for live with a different context than document (see here:  http://dev.jquery.com/ticket/4189), but the fix is not complete yet. If a parent element of the choosen context also matches the given selector-string, the live event will also fire.

I have added two patches for this.

Attachments

event-live-context.patch Download (784 bytes) - added by trixi 4 years ago.
closest-live-context.patch Download (776 bytes) - added by trixi 4 years ago.
closest-context.patch Download (650 bytes) - added by jollytoad 4 years ago.
Restrict closest to search only within the jQuery context

Change History

Changed 4 years ago by trixi

Changed 4 years ago by trixi

Changed 4 years ago by jollytoad

Restrict closest to search only within the jQuery context

comment:1 Changed 4 years ago by jollytoad

Good catch.

This has made me think that closest should be restricted to not traverse higher than the current jQuery context anyway - I attached a patch for this. And maybe the same should apply for other upward traversals too, ie. parent/parents.

Ah, I've just discovered this is not such a good idea. As jQuery doesn't accept an element as selector and context, so the following wouldn't work:

$(event.target, context).closest('.something')

Ok, ignore my patch! I'd remove it but can't find a way to in trac!

comment:2 Changed 4 years ago by john

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

It looks like this was landed as part of the recent live commits.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.