Skip to content

Commit c861ee8

Browse files
committed
Merge remote-tracking branch 'ress/issue518' into form_tests_theress
2 parents bef820d + dc4ab30 commit c861ee8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

jquery.pjax.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,20 @@ function uniqueId() {
562562
}
563563

564564
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+
565579
var cloned = container.clone()
566580
// Unmark script tags as already being eval'd so they can get executed again
567581
// when restored from cache. HAXX: Uses jQuery internal method.

0 commit comments

Comments
 (0)