mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
selectedIndex is now cloned in IE (#1294)
This commit is contained in:
parent
480aae72d3
commit
9b9a793273
40
src/jquery/jquery.js
vendored
40
src/jquery/jquery.js
vendored
@ -852,27 +852,37 @@ jQuery.fn = jQuery.prototype = {
|
|||||||
* @cat DOM/Manipulation
|
* @cat DOM/Manipulation
|
||||||
*/
|
*/
|
||||||
clone: function(deep) {
|
clone: function(deep) {
|
||||||
// Need to remove events on the element and its descendants
|
if (jQuery.browser.msie) {
|
||||||
var $this = this.add(this.find("*"));
|
// Need to remove events on the element and its descendants
|
||||||
$this.each(function() {
|
var $this = this.add(this.find("*"));
|
||||||
this._$events = {};
|
$this.each(function() {
|
||||||
for (var type in this.$events)
|
this._$events = {};
|
||||||
this._$events[type] = jQuery.extend({},this.$events[type]);
|
for (var type in this.$events)
|
||||||
}).unbind();
|
this._$events[type] = jQuery.extend({},this.$events[type]);
|
||||||
|
}).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 );
|
||||||
}) );
|
}) );
|
||||||
|
|
||||||
// Add the events back to the original and its descendants
|
if (jQuery.browser.msie) {
|
||||||
$this.each(function() {
|
// Add the events back to the original and its descendants
|
||||||
var events = this._$events;
|
$this.each(function() {
|
||||||
for (var type in events)
|
var events = this._$events;
|
||||||
for (var handler in events[type])
|
for (var type in events)
|
||||||
jQuery.event.add(this, type, events[type][handler], events[type][handler].data);
|
for (var handler in events[type])
|
||||||
this._$events = null;
|
jQuery.event.add(this, type, events[type][handler], events[type][handler].data);
|
||||||
});
|
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 New Issue
Block a user