Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#8782 closed bug (wontfix)

.append() Bug

Reported by: [email protected] Owned by:
Priority: low Milestone: 1.next
Component: event Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:


I have found this bug working with Firefox 3.6 and 4 using jquery 1.4 or 1.5:

<div id="cont"></div> <script> $('#cont').append('<img onload=alert("test") src=img/abc.jpg >'); </script>

When I append the image the onload event fires twice. I had not this problem with jquery 1.3

thanks in advance


Change History (4)

comment:1 Changed 12 years ago by timmywil

Component: unfiledevent
Status: newopen

Thank you for submitting a bug report to the jQuery project. In the future, please do not paste code in the ticket, but provide a test case on http://jsfiddle.net.

http://jsfiddle.net/timmywil/ERt2z/ It seems the inline event handler does get called twice.

comment:2 Changed 12 years ago by [email protected]

Having looked into this, I've narrowed this down to the call to clone that occurs in domManip around line 5362. I have no idea what the full implications of that call are, but - for example - hard-coding results.cacheable to false just before that call cancels the 'double event'. Hoping that's of some help to one of you who knows what you're doing :)

comment:3 Changed 12 years ago by Rick Waldron

Priority: undecidedlow
Resolution: wontfix
Status: openclosed

jQuery cannot be responsible for the behaviour inline of event handlers.

Note: See TracTickets for help on using tickets.