Adding some fixes for commit [6537]. If there's leading whitespace, or if an exception is thrown by innerHTML, we need to use the old style method.
This commit is contained in:
parent
cf8c1249d1
commit
fc4c691534
|
@ -189,9 +189,10 @@ 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] ) &&
|
(!jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
|
||||||
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
|
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
|
||||||
|
|
||||||
|
try {
|
||||||
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 ) {
|
||||||
|
@ -200,6 +201,11 @@ jQuery.fn.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If using innerHTML throws an exception, use the fallback method
|
||||||
|
} catch(e) {
|
||||||
|
this.empty().append( value );
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.empty().append( value );
|
this.empty().append( value );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue