Skip to content

Commit ebbbc34

Browse files
committed
Issue #2215857 followup by gaydamaka, timmillwood, alexpott, lauriii: Regression on Internet Explorer 11
(cherry picked from commit 266f3f9c1517e1b6b34891474a15f12dd3caa329)
1 parent 43f41c3 commit ebbbc34

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

misc/ajax.es6.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@
774774
// when there is a form such that this.$form.ajaxSubmit() is used instead of
775775
// $.ajax(). When there is no form and $.ajax() is used, beforeSerialize()
776776
// isn't called, but don't rely on that: explicitly check this.$form.
777-
if (this.$form && document.contains(this.$form.get(0))) {
777+
if (this.$form && document.body.contains(this.$form.get(0))) {
778778
const settings = this.settings || drupalSettings;
779779
Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize');
780780
}
@@ -1020,7 +1020,7 @@
10201020
// attachBehaviors() called on the new content from processing the response
10211021
// commands is not sufficient, because behaviors from the entire form need
10221022
// to be reattached.
1023-
if (this.$form && document.contains(this.$form.get(0))) {
1023+
if (this.$form && document.body.contains(this.$form.get(0))) {
10241024
const settings = this.settings || drupalSettings;
10251025
Drupal.attachBehaviors(this.$form.get(0), settings);
10261026
}
@@ -1090,7 +1090,7 @@
10901090
$(this.element).prop('disabled', false);
10911091
// Reattach behaviors, if they were detached in beforeSerialize(), and the
10921092
// form is still part of the document.
1093-
if (this.$form && document.contains(this.$form.get(0))) {
1093+
if (this.$form && document.body.contains(this.$form.get(0))) {
10941094
const settings = this.settings || drupalSettings;
10951095
Drupal.attachBehaviors(this.$form.get(0), settings);
10961096
}

misc/ajax.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
339339
};
340340

341341
Drupal.Ajax.prototype.beforeSerialize = function (element, options) {
342-
if (this.$form && document.contains(this.$form.get(0))) {
342+
if (this.$form && document.body.contains(this.$form.get(0))) {
343343
var settings = this.settings || drupalSettings;
344344
Drupal.detachBehaviors(this.$form.get(0), settings, 'serialize');
345345
}
@@ -451,7 +451,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
451451
}
452452
}
453453

454-
if (this.$form && document.contains(this.$form.get(0))) {
454+
if (this.$form && document.body.contains(this.$form.get(0))) {
455455
var settings = this.settings || drupalSettings;
456456
Drupal.attachBehaviors(this.$form.get(0), settings);
457457
}
@@ -493,7 +493,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
493493

494494
$(this.element).prop('disabled', false);
495495

496-
if (this.$form && document.contains(this.$form.get(0))) {
496+
if (this.$form && document.body.contains(this.$form.get(0))) {
497497
var settings = this.settings || drupalSettings;
498498
Drupal.attachBehaviors(this.$form.get(0), settings);
499499
}

0 commit comments

Comments
 (0)