( src, dest )
| 6257 | } |
| 6258 | |
| 6259 | function fixCloneNodeIssues( src, dest ) { |
| 6260 | var nodeName, e, data; |
| 6261 | |
| 6262 | // We do not need to do anything for non-Elements |
| 6263 | if ( dest.nodeType !== 1 ) { |
| 6264 | return; |
| 6265 | } |
| 6266 | |
| 6267 | nodeName = dest.nodeName.toLowerCase(); |
| 6268 | |
| 6269 | // IE6-8 copies events bound via attachEvent when using cloneNode. |
| 6270 | if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { |
| 6271 | data = jQuery._data( dest ); |
| 6272 | |
| 6273 | for ( e in data.events ) { |
| 6274 | jQuery.removeEvent( dest, e, data.handle ); |
| 6275 | } |
| 6276 | |
| 6277 | // Event data gets referenced instead of copied if the expando gets copied too |
| 6278 | dest.removeAttribute( jQuery.expando ); |
| 6279 | } |
| 6280 | |
| 6281 | // IE blanks contents when cloning scripts, and tries to evaluate newly-set text |
| 6282 | if ( nodeName === "script" && dest.text !== src.text ) { |
| 6283 | disableScript( dest ).text = src.text; |
| 6284 | restoreScript( dest ); |
| 6285 | |
| 6286 | // IE6-10 improperly clones children of object elements using classid. |
| 6287 | // IE10 throws NoModificationAllowedError if parent is null, #12132. |
| 6288 | } else if ( nodeName === "object" ) { |
| 6289 | if ( dest.parentNode ) { |
| 6290 | dest.outerHTML = src.outerHTML; |
| 6291 | } |
| 6292 | |
| 6293 | // This path appears unavoidable for IE9. When cloning an object |
| 6294 | // element in IE9, the outerHTML strategy above is not sufficient. |
| 6295 | // If the src has innerHTML and the destination does not, |
| 6296 | // copy the src.innerHTML into the dest.innerHTML. #10324 |
| 6297 | if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { |
| 6298 | dest.innerHTML = src.innerHTML; |
| 6299 | } |
| 6300 | |
| 6301 | } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { |
| 6302 | // IE6-8 fails to persist the checked state of a cloned checkbox |
| 6303 | // or radio button. Worse, IE6-7 fail to give the cloned element |
| 6304 | // a checked appearance if the defaultChecked value isn't also set |
| 6305 | |
| 6306 | dest.defaultChecked = dest.checked = src.checked; |
| 6307 | |
| 6308 | // IE6-7 get confused and end up setting the value of a cloned |
| 6309 | // checkbox/radio button to an empty string instead of "on" |
| 6310 | if ( dest.value !== src.value ) { |
| 6311 | dest.value = src.value; |
| 6312 | } |
| 6313 | |
| 6314 | // IE6-8 fails to return the selected option to the default selected |
| 6315 | // state when cloning options |
| 6316 | } else if ( nodeName === "option" ) { |
no test coverage detected