This project is archived and is in readonly mode.

#634 ✓resolved
Nick M

Safari double fires onchange event when container emptied

Reported by Nick M | April 9th, 2009 @ 05:43 PM | in 2.0 (closed)

If you have a select element with an onchange event listener, and inside that onchange function, you empty the parent element containing the select element, Safari fires the onchange event twice. Firefox and IE only fire the onchange event once.

I've attached a simple example showing the problem. The problem does not occur in Safari when using mootools 1.2.0, but versions 1.2.1 and the current trunk (6aa6aaf893ff85325c36fe2262f7aa406c95c14a) all have the same problem.

I encountered this while using a form that submits itself via Request.HTML when the form elements are changed. The form then needs to be re-rendered with the HTML response of the Ajax request. When using the "update" option in Request.HTML it fires the empty() method which then fires another onchange event and Ajax request in Safari. This second request is also invalid since all of the form elements have been reset at this point.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Attachments

Pages