Another fix for [6537] - make sure that .innerHTML isn't used on non-HTML documents and that we only attempt to use .innerHTML on DOM Elements.

This commit is contained in:
John Resig 2009-09-14 23:20:23 +00:00
parent 766635e862
commit 3eb56b09b8

View file

@ -189,16 +189,16 @@ jQuery.fn.extend({
// See if we can take a shortcut and just use innerHTML // See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !/<script/i.test( value ) && } else if ( typeof value === "string" && !/<script/i.test( value ) &&
this[0] && !jQuery.isXMLDoc( this[0] ) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
for ( var i = 0, l = this.length; i < l; i++ ) { for ( var i = 0, l = this.length; i < l; i++ ) {
// Remove element nodes and prevent memory leaks // Remove element nodes and prevent memory leaks
if ( this[i].nodeType === 1 ) { if ( this[i].nodeType === 1 ) {
cleanData( this[i].getElementsByTagName("*") ); cleanData( this[i].getElementsByTagName("*") );
}
this[i].innerHTML = value; this[i].innerHTML = value;
} }
}
} else { } else {
this.empty().append( value ); this.empty().append( value );