selectedIndex is now cloned in IE (#1294)
This commit is contained in:
parent
480aae72d3
commit
9b9a793273
10
src/jquery/jquery.js
vendored
10
src/jquery/jquery.js
vendored
|
@ -852,6 +852,7 @@ jQuery.fn = jQuery.prototype = {
|
||||||
* @cat DOM/Manipulation
|
* @cat DOM/Manipulation
|
||||||
*/
|
*/
|
||||||
clone: function(deep) {
|
clone: function(deep) {
|
||||||
|
if (jQuery.browser.msie) {
|
||||||
// Need to remove events on the element and its descendants
|
// Need to remove events on the element and its descendants
|
||||||
var $this = this.add(this.find("*"));
|
var $this = this.add(this.find("*"));
|
||||||
$this.each(function() {
|
$this.each(function() {
|
||||||
|
@ -859,12 +860,14 @@ jQuery.fn = jQuery.prototype = {
|
||||||
for (var type in this.$events)
|
for (var type in this.$events)
|
||||||
this._$events[type] = jQuery.extend({},this.$events[type]);
|
this._$events[type] = jQuery.extend({},this.$events[type]);
|
||||||
}).unbind();
|
}).unbind();
|
||||||
|
}
|
||||||
|
|
||||||
// Do the clone
|
// Do the clone
|
||||||
var r = this.pushStack( jQuery.map( this, function(a){
|
var r = this.pushStack( jQuery.map( this, function(a){
|
||||||
return a.cloneNode( deep != undefined ? deep : true );
|
return a.cloneNode( deep != undefined ? deep : true );
|
||||||
}) );
|
}) );
|
||||||
|
|
||||||
|
if (jQuery.browser.msie) {
|
||||||
// Add the events back to the original and its descendants
|
// Add the events back to the original and its descendants
|
||||||
$this.each(function() {
|
$this.each(function() {
|
||||||
var events = this._$events;
|
var events = this._$events;
|
||||||
|
@ -874,6 +877,13 @@ jQuery.fn = jQuery.prototype = {
|
||||||
this._$events = null;
|
this._$events = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// set selected values of select elements
|
||||||
|
var selects = r.find('select');
|
||||||
|
$this.filter('select').each(function(i) {
|
||||||
|
selects[i].selectedIndex = this.selectedIndex;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Return the cloned set
|
// Return the cloned set
|
||||||
return r;
|
return r;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue