diff --git a/core/misc/ajax.js b/core/misc/ajax.js
index b63bc03..3964935 100644
--- a/core/misc/ajax.js
+++ b/core/misc/ajax.js
@@ -891,13 +891,14 @@
       var method = response.method || ajax.method;
       var effect = ajax.getEffect(response);
       var settings;
+      var new_content_parent;
 
       // We don't know what response.data contains: it might be a string of text
       // without HTML, so don't rely on jQuery correctly interpreting
       // $(response.data) as new HTML rather than a CSS selector. Also, if
       // response.data contains top-level text nodes, they get lost with either
       // $(response.data) or $('<div></div>').replaceWith(response.data).
-      var new_content_wrapped = $('<div></div>').html(response.data);
+      var new_content_wrapped = $('<div class="test"></div>').html('e<div style="height: 100px; font-size: 30px">test</div><div style="height: 100px; font-size: 30px">test</div>e');
       var new_content = new_content_wrapped.contents();
 
       // For legacy reasons, the effects processing code assumes that
@@ -912,7 +913,8 @@
       // it doesn't. For more information, please see
       // https://www.drupal.org/node/736066.
       if (new_content.length !== 1 || new_content.get(0).nodeType !== 1) {
-        new_content = new_content_wrapped;
+        new_content = new_content.parent();
+        new_content_parent = true;
       }
 
       // If removing content from the wrapper, detach behaviors first.
@@ -942,7 +944,9 @@
         new_content.find('.ajax-new-content')[effect.showEffect](effect.showSpeed);
       }
       else if (effect.showEffect !== 'show') {
-        new_content[effect.showEffect](effect.showSpeed);
+        new_content[effect.showEffect](3000, function () {
+          $(this).contents().unwrap();
+        });
       }
 
       // Attach all JavaScript behaviors to the new content, if it was
@@ -951,6 +955,14 @@
       if (new_content.parents('html').length > 0) {
         // Apply any settings from the returned JSON if available.
         settings = response.settings || ajax.settings || drupalSettings;
+
+        if(new_content_parent) {
+          new_content = new_content.parent();
+          new_content.css({
+            'color': 'red'
+          })
+        }
+
         Drupal.attachBehaviors(new_content.get(0), settings);
       }
     },
