This project is archived and is in readonly mode.

#372 ✓invalid
Dr.Death

ie don't clone onchange attribute of select boxes

Reported by Dr.Death | September 9th, 2008 @ 11:43 AM

after clone() select element necessary do set('onchange', function() {...})

Comments and changes to this ticket

  • Dr.Death

    Dr.Death September 9th, 2008 @ 03:26 PM

    P.S. do select.addEvent('change', function() {...})

  • Daniel Steigerwald

    Daniel Steigerwald September 10th, 2008 @ 12:56 PM

    Events are not to be cloned. Inlines (by attribute) and attached (addEvent) both. It's correct behavior. Use cloneEvents.

  • Dr.Death

    Dr.Death September 10th, 2008 @ 01:04 PM

    hm... in opera, firefox, safari "onchange" attribute stay in new cloned "select" and work like it must, in IE "onchange" stay in cloned "select" but stop working...

  • Daniel Steigerwald

    Daniel Steigerwald September 10th, 2008 @ 05:27 PM

    Can't be everything in the whole world fixed :)

    Listen the story. You can clone element with html or cloneNode. innerHTML is much more buggy than cloneNode. There are two types of event registration: as an attribute or via attachEvent/addEventListener methods. Wanted behaviour of node cloning is: to get new node without events. IE has a big bug, cloneNode clones nodes with both types of events. Current mootools dev edge has great fast hack to clear all events from new clone + some another forms related bugs workarounds. If W3C browser clone also attributes events (onchange), that's not big deal, because anyway you shoul not use that type of event registration - leak in IE.

    The final story. Forget about onchange and use el.addEvent('onchange'.. and new cloned node will have not any event registered.

    PS: there are also some additional bugs related to cloneEvent, e.g. in Internet Explorer, if you attach object directly to node, there references will be cloned to. But you should not do that, use element storage instead :)

  • fakedarren

    fakedarren February 8th, 2010 @ 03:06 PM

    • State changed from “new” to “invalid”
    • Assigned user cleared.
    • Milestone cleared.

Create your profile

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

Shared Ticket Bins

Tags

Pages