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: | augustus.kling@gmail.com | Owned by: | rwaldron |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | event | Version: | 1.6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When an event handler for the
DOMNodeInsertedevent is attached to the document node using
bind, the handler gets called as expected. However when
liveis used to bind the handler, the handler is not called.
According to the documentation of
live, it should work for “custom events as well as all JavaScript events that bubble”.
DOMNodeInsertedbubbles according to http://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeInserted and should therefore be supported using
live.
See http://jsfiddle.net/4tVAx/1/ 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 comment:1
component: | unfiled → event |
---|---|
owner: | → rwaldron |
priority: | undecided → low |
status: | new → assigned |
Changed May 07, 2011 10:35PM UTC by 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
$('html').liveinstead of
$(document).live.
In the meantime I noted that
$(document).livealso fails for other event types such as
click, too. Is it possible that
liveonly 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
document(as expected) when using
bind, but not not when using
live.
Changed May 08, 2011 04:58PM UTC by 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 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 comment:6
resolution: | → wontfix |
---|---|
status: | assigned → closed |