diff --git a/core/modules/views/src/Ajax/ReplaceTitleCommand.php b/core/modules/views/src/Ajax/ReplaceTitleCommand.php
index 8972969..4d5bb63 100644
--- a/core/modules/views/src/Ajax/ReplaceTitleCommand.php
+++ b/core/modules/views/src/Ajax/ReplaceTitleCommand.php
@@ -39,7 +39,7 @@ public function __construct($title) {
public function render() {
return array(
'command' => 'viewsReplaceTitle',
- 'selector' => $this->title,
+ 'title' => $this->title,
);
}
diff --git a/core/modules/views_ui/js/ajax.js b/core/modules/views_ui/js/ajax.js
index e30b4c1..00cffe9 100644
--- a/core/modules/views_ui/js/ajax.js
+++ b/core/modules/views_ui/js/ajax.js
@@ -27,14 +27,13 @@
Drupal.AjaxCommands.prototype.viewsReplaceTitle = function (ajax, response, status) {
var doc = document;
// For the
element, make a best-effort attempt to replace the page
- // title and leave the site name alone. If the theme doesn't use the site
- // name in the element, this will fail.
+ // title and leave the site name alone.
var oldTitle = doc.title;
- // Escape the site name, in case it has special characters in it, so we can
- // use it in our regex.
- var escapedSiteName = response.siteName.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- var re = new RegExp('.+ (.) ' + escapedSiteName);
- doc.title = oldTitle.replace(re, response.title + ' $1 ' + response.siteName);
+ // Escape the current page title, in case it has special characters in it,
+ // so we can use it in our regex.
+ var escapedPageTitle = $('h1.page-title').text().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+ var re = new RegExp(escapedPageTitle + ' (.) (.+)');
+ doc.title = oldTitle.replace(re, response.title + ' $1 $2');
$('h1.page-title').text(response.title);
};