Skip to main content

Bug Tracker

Side navigation

#9169 closed bug (wontfix)

Opened May 07, 2011 09:04PM UTC

Closed July 12, 2011 07:12PM UTC

.live fails to call handler for DOMNodeInserted

Reported by: Owned by: rwaldron
Priority: low Milestone:
Component: event Version: 1.6
Keywords: Cc:
Blocked by: Blocking:

When an event handler for the

event is attached to the document node using
, the handler gets called as expected. However when
is used to bind the handler, the handler is not called.

According to the documentation of

, it should work for “custom events as well as all JavaScript events that bubble”.
bubbles according to and should therefore be supported using

See for a demo. Clicking the button should give 2 lines in the console. One starting with “bind”, the other starting with “live”.

Verified with Firefox 4.0.1, Chromium 11.0.696.57 (82915) on Ubuntu 11.04 and jQuery versions 1.4.4, 1.5.2, 1.6.

Attachments (0)
Change History (6)

Changed May 07, 2011 10:30PM UTC by rwaldron comment:1

component: unfiledevent
owner: → rwaldron
priority: undecidedlow
status: newassigned

Changed May 07, 2011 10:35PM UTC by rwaldron comment:2

binding a live listener to an actual selector works....

Changed May 08, 2011 08:51AM UTC by comment:3

That allows for using

instead of

In the meantime I noted that

also fails for other event types such as
, too. Is it possible that
only works for element nodes?

Probably the initial bug description is then misleading when it names a specific event type. It seems events do bubble up to

(as expected) when using
, but not not when using

Changed May 08, 2011 04:58PM UTC by timmywil comment:4

It doesn't really make sense to call $(document).live since live works by allowing the event to bubble up to the document and then distributing the event to the appropriate targets. There's no need for live in that case. It sounds like what you really want is to bind to the document.

Changed May 08, 2011 05:25PM UTC by rwaldron comment:5

I guess I should've noted in my comment that I wasn't implying a fix, but more that I only had time to try that example that I provided. More importantly, I wanted to confirm the validity of this ticket before proceeding. The docs say "Attach a handler to the event for all elements which match the current selector, now and in the future"... the keyword being "selector".

Changed July 12, 2011 07:12PM UTC by rwaldron comment:6

resolution: → wontfix
status: assignedclosed