From 412c5dfb0d6301dc0b3d7c98325cc9908dd97511 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Wed, 27 Jan 2016 12:19:29 -0500 Subject: [PATCH] Revert "Manipulation: don't auto-insert tbody" This reverts commit e984d1c79cc476062818e03df04a366baa13d197. Fixes gh-2861 --- src/manipulation.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/manipulation.js b/src/manipulation.js index b65699bac..afd5091dd 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -38,14 +38,14 @@ var rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*\s*$/g; +// Manipulating tables requires a tbody function manipulationTarget( elem, content ) { - if ( jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? - return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; - } - - return elem; + elem.getElementsByTagName( "tbody" )[ 0 ] || + elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : + elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation -- 2.39.5