Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14264 closed bug (invalid)

Click event lost if element content changes mid-click

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: None
Component: unfiled Version: 2.0.2
Keywords: Cc:
Blocked by: Blocking:

Description

If the content of an element changes between mouse mouse down and mouse up then the click event seem to not fire.

Repro here

Change History (5)

comment:1 Changed 6 years ago by sergioafp

I submitted this. Sorry, forgot to login first.

comment:2 Changed 6 years ago by dmethvin

Owner: set to anonymous
Status: newpending

Does the problem also occur with bare DOM methods like addEventListener? If so the event just isn't happening. Please create a test case without jQuery and let us know.

comment:3 Changed 6 years ago by sergioafp

The issue has more to do with $.html('new content') than with the event code. I've updated my repro (http://jsfiddle.net/apEbX/5/). Note how the problem happens with addEventListener as well but it goes away if I don't use jQuery to update the element's content.

comment:4 Changed 6 years ago by dmethvin

A few more test cases to narrow it down. Note that the original case is passing a *number* to .html() and not a string. Once it's a string the method goes through the .innerHTML path and works as expected. However I haven't looked at why it would break, the bare DOM case should be similar to the .empty().append() case.

http://jsfiddle.net/apEbX/6/

comment:5 Changed 6 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.