diff --git a/core/misc/ajax.es6.js b/core/misc/ajax.es6.js index 91680d510b..70e33c6b42 100644 --- a/core/misc/ajax.es6.js +++ b/core/misc/ajax.es6.js @@ -982,8 +982,8 @@ /** * Provide a wrapper for new content via Ajax. * - * Wrap the inserted markup when trying to insert multiple root elements with - * a ajax effect. + * Wrap the inserted markup when inserting multiple root elements with an + * ajax effect. * * @param {jQuery} $newContent * Response elements after parsing. @@ -993,10 +993,12 @@ * The response from the Ajax request. * * @deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.0. - * Use data with desired wrapper. See https://www.drupal.org/node/2974880. + * Use data with desired wrapper. See https://www.drupal.org/node/2974880. * - * @todo: Add deprecation warning after it will be possible. See - * https://www.drupal.org/project/drupal/issues/2973400 + * @todo Add deprecation warning after it is possible. For more information + * see: https://www.drupal.org/project/drupal/issues/2973400 + * + * @see https://www.drupal.org/node/2940704 */ Drupal.theme.ajaxWrapperNewContent = ($newContent, ajax, response) => ( (response.effect || ajax.effect) !== 'none' && @@ -1020,13 +1022,15 @@ * Response elements after parsing. * * @deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.0. - * Use data with desired wrapper. See https://www.drupal.org/node/2974880. + * Use data with desired wrapper. See https://www.drupal.org/node/2974880. + * + * @todo Add deprecation warning after it is possible. For more information + * see: https://www.drupal.org/project/drupal/issues/2973400 * - * @todo: Add deprecation warning after it will be possible. See - * https://www.drupal.org/project/drupal/issues/2973400 + * @see https://www.drupal.org/node/2940704 */ Drupal.theme.ajaxWrapperMultipleRootElements = ($elements) => ( - $('
').append($elements) + $('').append($elements) ); /** @@ -1089,8 +1093,9 @@ // Parse response.data into an element collection. let $newContent = $($.parseHTML(response.data, document, true)); // For backward compatibility, in some cases a wrapper will be added. This - // behavior will be removed before Drupal 9.0.0. Use theming to change it. - // See https://www.drupal.org/node/2940704. + // behavior will be removed before Drupal 9.0.0. If different behavior is + // needed, the theme functions can be overriden. + // @see https://www.drupal.org/node/2940704 $newContent = Drupal.theme('ajaxWrapperNewContent', $newContent, ajax, response); // If removing content from the wrapper, detach behaviors first. diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 3506c56a96..1dceeaa84d 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -485,7 +485,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr }; Drupal.theme.ajaxWrapperMultipleRootElements = function ($elements) { - return $('').append($elements); + return $('').append($elements); }; Drupal.AjaxCommands = function () {}; diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php index 3e564cec09..88dfdf61a6 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php @@ -117,7 +117,7 @@ public function testInsertAjaxResponse() { // This is temporary behavior for BC reason. $render_multiple_root_wrapper = []; foreach ($render_multiple_root_unwrapper as $key => $render) { - $render_multiple_root_wrapper["$key--effect"] = '