This project is archived and is in readonly mode.

#283 ✓invalid
James Sleeman

clone leaking into addEvent(s) / removeEvent(s) causes exception

Reported by James Sleeman | July 31st, 2008 @ 02:14 PM | in 2.0 (closed)

In working with MT I have had too modify both Element.Event.js addEvent() and Element.Event.js removeEvent() to check if the type passed to it was 'clone' and if so return without doing anything, I added to both methods:

if (type == 'clone') return this;

The reson for this is the addEvents() and removeEvents() methods (Element.Event.js) were leaking this method of the events objects passed and causing exceptions when:


was attempted to be accessed in addEvent()/removeEvent().

This was noticed both through the Browser.freeMem method and also in the AutoCompleter plugin (third party) where by it performs the following...

	addChoiceEvents: function(el) {
		return el.addEvents({
			'mouseover': this.choiceOver.bind(this, [el]),
			'click': this.choiceSelect.bind(this, [el])

I don't see anything particularly wrong with the manner in which addEvents() is being called and thus it appears that not detecting the passing of the "clone" method (erroneously) is an error in the Mootools core and could be fixed in the manner I describe above.

Comments and changes to this ticket

  • Tom Occhino

    Tom Occhino September 21st, 2008 @ 05:00 PM

    • State changed from “new” to “invalid”
    • Tag changed from core, defect, events, major to core, defect, events, major

    when should 'clone' ever be passed to addEvent as an event type?

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