This project is archived and is in readonly mode.

#201 ✓resolved
Krzyko

clone doesn't maintain <select> state

Reported by Krzyko | July 7th, 2008 @ 09:31 PM | in 2.0 (closed)

Let's assume that I have elements and one of these options is preselected (selected='selected'). Then, when I try to clone this element (or this element is children of the cloned element) the selected='selected' attribute is not cloned. The problem occurs with MooTools 1.2 (and was also present in the 1.11) both in IE6 and IE7. elements are contained within sortable element (and as I understand the MooTools code, fixing clone bug will also fix the sortables behaviour).

Comments and changes to this ticket

  • Krzyko

    Krzyko July 8th, 2008 @ 04:12 PM

    • Title changed from “'selected' attribute of the <option> tag not cloned under IE” to “clone doesn't maintain <select> state”
    • Tag changed from 1.2, clone, ie, minor to 1.2, clone, minor

    An there is even more. Under other browsers (FF,Opera,Safari) cloning element does not clone actual selected but only the initial one. That is, when I change selected option in the example from 4th to 3rd and then click to clone this element, the cloned element under FF,Opera,Safari still has 4th option selected.

  • Krzyko

    Krzyko July 18th, 2008 @ 11:52 AM

    • Tag changed from 1.2, clone, minor to 1.2, clone, minor, patch

    I'm attaching a patch (against mootools 1.2) which is working for me (using all browsers). Two notes about this patch (reasons of which patch looks as it looks):

    1. It's necessary to copy selectedIndex property after copying contents (children).

    2. Copying selectedIndex property without copying children elements is useless.

    Fell free to apply and/or modify this patch.

  • Krzyko
  • Jan Kassens

    Jan Kassens July 18th, 2008 @ 05:22 PM

    • State changed from “new” to “open”

    i think #218 would fix this one as well.

  • Jan Kassens

    Jan Kassens August 31st, 2008 @ 07:18 PM

    • State changed from “open” to “resolved”

    Fixed with the brand new Element.clone.

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

Tags

Pages