diff --git a/core/modules/views/js/ajax_view.es6.js b/core/modules/views/js/ajax_view.es6.js
index 9a07351f3d..47d7abe5e7 100644
--- a/core/modules/views/js/ajax_view.es6.js
+++ b/core/modules/views/js/ajax_view.es6.js
@@ -18,8 +18,8 @@
       const {
         views: { ajaxViews },
       } = settings;
-      Object.keys(ajaxViews || {}).forEach((i) => {
-        Drupal.views.instances[i] = new Drupal.views.ajaxView(ajaxViews[i]);
+      Drupal.views.sortByNestingLevel(ajaxViews).forEach(({ key, value }) => {
+        Drupal.views.instances[key] = new Drupal.views.ajaxView(value);
       });
     }
   };
@@ -51,7 +51,34 @@
   Drupal.views.instances = {};
 
   /**
-   * JavaScript object for a certain view.
+   * Sort the view Javascript objects by nesting level.
+   *
+   * @param {object} ajaxViews
+   *   The views JavaScript object.
+   * @param {string} settings.view_dom_id
+   *   The DOM id of the view.
+   * @param {string} settings.selector
+   *   The selector of the view.
+   *
+   * @return {object}
+   *   The sorted ajaxViews object.
+   */
+  Drupal.views.sortByNestingLevel = function(ajaxViews) {
+    const ajaxViewsArray = Object.keys(ajaxViews || {}).map(key => {
+      ajaxViews[key].selector = `.js-view-dom-id-${ajaxViews[key].view_dom_id}`;
+
+      return {
+        key,
+        value: ajaxViews[key],
+        nestingLevel: $(ajaxViews[key].selector).parents('.view').length,
+      };
+    });
+
+    return ajaxViewsArray.sort((a, b) => b.nestingLevel - a.nestingLevel);
+  };
+
+  /**
+   * Javascript object for a certain view.
    *
    * @constructor
    *
@@ -60,8 +87,8 @@
    * @param {string} settings.view_dom_id
    *   The DOM id of the view.
    */
-  Drupal.views.ajaxView = function (settings) {
-    const selector = `.js-view-dom-id-${settings.view_dom_id}`;
+  Drupal.views.ajaxView = function(settings) {
+    const { selector } = settings;
     this.$view = $(selector);
 
     // Retrieve the path to use for views' ajax.
@@ -110,12 +137,12 @@
       .each($.proxy(this.attachExposedFormAjax, this));
 
     // Add the ajax to pagers.
-    this.$view
-      // Don't attach to nested views. Doing so would attach multiple behaviors
-      // to a given element.
-      .filter($.proxy(this.filterNestedViews, this))
+    this.$pager_links = this.$view.find(
+      'ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a',
+    );
+    this.$pager_links
       .once('ajax-pager')
-      .each($.proxy(this.attachPagerAjax, this));
+      .each($.proxy(this.attachPagerLinkAjax, this));
 
     // Add a trigger to update this view specifically. In order to trigger a
     // refresh use the following code.
@@ -128,49 +155,36 @@
       base: this.selector,
       element: this.$view.get(0),
     });
+    // Remove unwanted parameter.
+    delete selfSettings.selector;
     this.refreshViewAjax = Drupal.ajax(selfSettings);
   };
 
   /**
-   * @method
+   * Attach the ajax behavior to exposed form fields.
+   *
+   * @param {string} [id]
+   *   The ID of the form.
+   * @param {HTMLElement} form
+   *   The form element.
    */
-  Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () {
-    const that = this;
+  Drupal.views.ajaxView.prototype.attachExposedFormAjax = function(id, form) {
     this.exposedFormAjax = [];
     // Exclude the reset buttons so no AJAX behaviors are bound. Many things
     // break during the form reset phase if using AJAX.
-    $('input[type=submit], input[type=image]', this.$exposed_form)
+    $('input[type=submit], input[type=image]', form)
       .not('[data-drupal-selector=edit-reset]')
-      .each(function (index) {
-        const selfSettings = $.extend({}, that.element_settings, {
-          base: $(this).attr('id'),
-          element: this,
+      .each((index, element) => {
+        const selfSettings = $.extend({}, this.element_settings, {
+          base: $(element).attr('id'),
+          element,
         });
-        that.exposedFormAjax[index] = Drupal.ajax(selfSettings);
+        // Remove unwanted parameter.
+        delete selfSettings.selector;
+        this.exposedFormAjax[index] = Drupal.ajax(selfSettings);
       });
   };
 
-  /**
-   * @return {bool}
-   *   If there is at least one parent with a view class return false.
-   */
-  Drupal.views.ajaxView.prototype.filterNestedViews = function () {
-    // If there is at least one parent with a view class, this view
-    // is nested (e.g., an attachment). Bail.
-    return !this.$view.parents('.view').length;
-  };
-
-  /**
-   * Attach the ajax behavior to each link.
-   */
-  Drupal.views.ajaxView.prototype.attachPagerAjax = function () {
-    this.$view
-      .find(
-        'ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a',
-      )
-      .each($.proxy(this.attachPagerLinkAjax, this));
-  };
-
   /**
    * Attach the ajax behavior to a singe link.
    *
@@ -198,6 +212,8 @@
       base: false,
       element: link,
     });
+    // Remove unwanted parameter.
+    delete selfSettings.selector;
     this.pagerAjax = Drupal.ajax(selfSettings);
   };
 
diff --git a/core/modules/views/js/ajax_view.js b/core/modules/views/js/ajax_view.js
index 794bf80a62..4c3aea1c3f 100644
--- a/core/modules/views/js/ajax_view.js
+++ b/core/modules/views/js/ajax_view.js
@@ -11,8 +11,12 @@
   Drupal.behaviors.ViewsAjaxView.attach = function (context, settings) {
     if (settings && settings.views && settings.views.ajaxViews) {
       var ajaxViews = settings.views.ajaxViews;
-      Object.keys(ajaxViews || {}).forEach(function (i) {
-        Drupal.views.instances[i] = new Drupal.views.ajaxView(ajaxViews[i]);
+
+      Drupal.views.sortByNestingLevel(ajaxViews).forEach(function (_ref) {
+        var key = _ref.key,
+            value = _ref.value;
+
+        Drupal.views.instances[key] = new Drupal.views.ajaxView(value);
       });
     }
   };
@@ -36,8 +40,25 @@
   Drupal.views = {};
   Drupal.views.instances = {};
 
+  Drupal.views.sortByNestingLevel = function (ajaxViews) {
+    var ajaxViewsArray = Object.keys(ajaxViews || {}).map(function (key) {
+      ajaxViews[key].selector = '.js-view-dom-id-' + ajaxViews[key].view_dom_id;
+
+      return {
+        key: key,
+        value: ajaxViews[key],
+        nestingLevel: $(ajaxViews[key].selector).parents('.view').length
+      };
+    });
+
+    return ajaxViewsArray.sort(function (a, b) {
+      return b.nestingLevel - a.nestingLevel;
+    });
+  };
+
   Drupal.views.ajaxView = function (settings) {
-    var selector = ".js-view-dom-id-".concat(settings.view_dom_id);
+    var selector = settings.selector;
+
     this.$view = $(selector);
     var ajaxPath = drupalSettings.views.ajax_path;
 
@@ -68,33 +89,34 @@
     this.settings = settings;
     this.$exposed_form = $("form#views-exposed-form-".concat(settings.view_name.replace(/_/g, '-'), "-").concat(settings.view_display_id.replace(/_/g, '-')));
     this.$exposed_form.once('exposed-form').each($.proxy(this.attachExposedFormAjax, this));
-    this.$view.filter($.proxy(this.filterNestedViews, this)).once('ajax-pager').each($.proxy(this.attachPagerAjax, this));
+
+    this.$pager_links = this.$view.find('ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a');
+    this.$pager_links.once('ajax-pager').each($.proxy(this.attachPagerLinkAjax, this));
+
     var selfSettings = $.extend({}, this.element_settings, {
       event: 'RefreshView',
       base: this.selector,
       element: this.$view.get(0)
     });
+
+    delete selfSettings.selector;
     this.refreshViewAjax = Drupal.ajax(selfSettings);
   };
 
-  Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () {
-    var that = this;
+  Drupal.views.ajaxView.prototype.attachExposedFormAjax = function (id, form) {
+    var _this = this;
+
     this.exposedFormAjax = [];
-    $('input[type=submit], input[type=image]', this.$exposed_form).not('[data-drupal-selector=edit-reset]').each(function (index) {
-      var selfSettings = $.extend({}, that.element_settings, {
-        base: $(this).attr('id'),
-        element: this
-      });
-      that.exposedFormAjax[index] = Drupal.ajax(selfSettings);
-    });
-  };
 
-  Drupal.views.ajaxView.prototype.filterNestedViews = function () {
-    return !this.$view.parents('.view').length;
-  };
+    $('input[type=submit], input[type=image]', form).not('[data-drupal-selector=edit-reset]').each(function (index, element) {
+      var selfSettings = $.extend({}, _this.element_settings, {
+        base: $(element).attr('id'),
+        element: element
+      });
 
-  Drupal.views.ajaxView.prototype.attachPagerAjax = function () {
-    this.$view.find('ul.js-pager__items > li > a, th.views-field a, .attachment .views-summary a').each($.proxy(this.attachPagerLinkAjax, this));
+      delete selfSettings.selector;
+      _this.exposedFormAjax[index] = Drupal.ajax(selfSettings);
+    });
   };
 
   Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function (id, link) {
@@ -107,6 +129,8 @@
       base: false,
       element: link
     });
+
+    delete selfSettings.selector;
     this.pagerAjax = Drupal.ajax(selfSettings);
   };
 
@@ -124,4 +148,4 @@
       }, 500);
     }
   };
-})(jQuery, Drupal, drupalSettings);
\ No newline at end of file
+})(jQuery, Drupal, drupalSettings);
