Skip to main content

Bug Tracker

Side navigation

#12479 closed bug (invalid)

Opened September 06, 2012 06:12PM UTC

Closed September 07, 2012 03:14AM UTC

Last modified November 05, 2012 03:27PM UTC

Clone Flaw Undocumented

Reported by: anonymous Owned by:
Priority: low Milestone: None
Component: manipulation Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:

As explains, $('select').clone() will NOT clone the selection the user has made to the select. As per that bug, clone will never get a fix for this issue (due to performance reasons).

That's all well and good, but there's no reason to leave jQuery users in the dark; we shouldn't have to wade through endless comments/blog posts/message boards/Stack Overflow questions just to learn that this is "working as intended". A simple addition of one sentence to clone's documentation would remedy matters:

"NOTE: For performance reasons clone does not copy the selectedIndex of cloned select elements; you can work around this limitation by separately copying the selectedIndex to your cloned select."

Attachments (0)
Change History (3)

Changed September 07, 2012 03:14AM UTC by dmethvin comment:1

component: unfiledmanipulation
keywords: → needsdocs
priority: undecidedlow
resolution: → invalid
status: newclosed

More generally, we don't try to copy the dynamic state to the cloned element. So if the user changes a select or types different text into a text box, those changes don't end up being copied. We can add docs to that effect.

Changed October 15, 2012 07:13PM UTC by mikesherov comment:2

keywords: needsdocs

Changed November 05, 2012 03:27PM UTC by timmywil comment:3

#12849 is a duplicate of this ticket.