#1049 new
Taloncor

Element.clone() does not copy selectedIndex property for select-elements

Reported by Taloncor | May 6th, 2010 @ 05:03 PM

Cloning a select-element won't clone the selectedIndex property of the original element.

Browser: Firefox 3.6.3 (Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.3) Gecko/20100401 SUSE/3.6.3-1.2 Firefox/3.6.3)

Comments and changes to this ticket

  • Michael Tryczak

    Michael Tryczak May 10th, 2013 @ 10:17 AM

    Three years without so much as a comment. I can only confirm that this is still an issue in v1.7.1.0:

    element.clone(true)
    

    returns a deep clone of the element, with all properties and child element properties intact (including, for example, input.value), however the selectedIndex property of any and all select elements is lost.

    Work-around: loop through all select elements in the cloned element, and set the selectedIndex property programmatically.

  • Victor

    Victor August 13th, 2013 @ 11:20 AM

    It is more browser-related issue, I've tried http://jsfiddle.net/Z24EV/1/ - selectedIndex is cloned in current Chrome, Firefox 10+, Opera 12+, IE9+. As far as I can see only IE8- isn't cloning selectedIndex.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

The Prototype JavaScript library.

Shared Ticket Bins

Attachments

Pages