$(document).unbind('click') clears live click events

$(document).unbind('click') clears live click events


This is probably as expected, but $(document).unbind('click')
clears .live() click events. Is this a bug to be filed, or is that
what we want to happen? I understand that .Iive() sets events on the
document, but I still vote for bug. Or at least document it
under .live(.
In my code:
$('.closeFilter').live('click', this.close);
is getting cleared by
$(document).unbind('click');
And speaking of the .live() documentation. It's inaccurate:
"When you bind a "live" event it will bind to all current and future
elements on the page"
Nothing gets 'bound' to current and future elements on the page, its
bound to the document and checking if the original target of the event
matches the selector. Unless I'm misunderstanding what happens. It
would be more accurate to say that .live acts as if it was an event
bound to all current and future elements on the page.
"Live events do not bubble in the traditional manner"
Yes they do, they are just already at the document level.
I understand that this documentation might be trying to simplify what
is actually going on, but it makes figuring out that $(document).unbind
('click'); is clearing my live click events difficult, and doesn't
make it clear that mousemove and mouseover events can hava a dramatic
impact on page performance.
Ok, thanks bye.
Josh Powell


























    • Topic Participants

    • josh