( src, dest )
| 5416 | } |
| 5417 | |
| 5418 | function fixCloneNodeIssues( src, dest ) { |
| 5419 | var nodeName, e, data; |
| 5420 | |
| 5421 | // We do not need to do anything for non-Elements |
| 5422 | if ( dest.nodeType !== 1 ) { |
| 5423 | return; |
| 5424 | } |
| 5425 | |
| 5426 | nodeName = dest.nodeName.toLowerCase(); |
| 5427 | |
| 5428 | // IE6-8 copies events bound via attachEvent when using cloneNode. |
| 5429 | if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { |
| 5430 | data = jQuery._data( dest ); |
| 5431 | |
| 5432 | for ( e in data.events ) { |
| 5433 | jQuery.removeEvent( dest, e, data.handle ); |
| 5434 | } |
| 5435 | |
| 5436 | // Event data gets referenced instead of copied if the expando gets copied too |
| 5437 | dest.removeAttribute( jQuery.expando ); |
| 5438 | } |
| 5439 | |
| 5440 | // IE blanks contents when cloning scripts, and tries to evaluate newly-set text |
| 5441 | if ( nodeName === "script" && dest.text !== src.text ) { |
| 5442 | disableScript( dest ).text = src.text; |
| 5443 | restoreScript( dest ); |
| 5444 | |
| 5445 | // IE6-10 improperly clones children of object elements using classid. |
| 5446 | // IE10 throws NoModificationAllowedError if parent is null, #12132. |
| 5447 | } else if ( nodeName === "object" ) { |
| 5448 | if ( dest.parentNode ) { |
| 5449 | dest.outerHTML = src.outerHTML; |
| 5450 | } |
| 5451 | |
| 5452 | // This path appears unavoidable for IE9. When cloning an object |
| 5453 | // element in IE9, the outerHTML strategy above is not sufficient. |
| 5454 | // If the src has innerHTML and the destination does not, |
| 5455 | // copy the src.innerHTML into the dest.innerHTML. #10324 |
| 5456 | if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { |
| 5457 | dest.innerHTML = src.innerHTML; |
| 5458 | } |
| 5459 | |
| 5460 | } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { |
| 5461 | // IE6-8 fails to persist the checked state of a cloned checkbox |
| 5462 | // or radio button. Worse, IE6-7 fail to give the cloned element |
| 5463 | // a checked appearance if the defaultChecked value isn't also set |
| 5464 | |
| 5465 | dest.defaultChecked = dest.checked = src.checked; |
| 5466 | |
| 5467 | // IE6-7 get confused and end up setting the value of a cloned |
| 5468 | // checkbox/radio button to an empty string instead of "on" |
| 5469 | if ( dest.value !== src.value ) { |
| 5470 | dest.value = src.value; |
| 5471 | } |
| 5472 | |
| 5473 | // IE6-8 fails to return the selected option to the default selected |
| 5474 | // state when cloning options |
| 5475 | } else if ( nodeName === "option" ) { |
no test coverage detected