File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -562,6 +562,20 @@ function uniqueId() {
562
562
}
563
563
564
564
function cloneContents ( container ) {
565
+ // Preserve textarea values
566
+ var textarea = findAll ( container , "textarea" )
567
+ textarea . text ( function ( i , text ) { return textarea [ i ] . value } )
568
+
569
+ // Preserve select values
570
+ findAll ( container , "select" ) . each ( function ( i , elem ) {
571
+ elem = $ ( elem ) ;
572
+ var values = $ ( elem ) . val ( ) ;
573
+ elem . find ( 'option[selected]' ) . attr ( 'selected' , false ) ;
574
+ elem . find ( 'option' ) . filter ( function ( ) {
575
+ return ( $ . inArray ( this . value , values ) !== - 1 ) ;
576
+ } ) . attr ( 'selected' , true ) ;
577
+ } )
578
+
565
579
var cloned = container . clone ( )
566
580
// Unmark script tags as already being eval'd so they can get executed again
567
581
// when restored from cache. HAXX: Uses jQuery internal method.
You can’t perform that action at this time.
0 commit comments