From: Coleman Watts Date: Sun, 25 Oct 2015 15:50:43 +0000 (-0400) Subject: Force page title to plain text X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7565f24a8fd07b2e874e147929bdcb45b3e4af10;p=civicrm-core.git Force page title to plain text --- diff --git a/ang/crmUi.js b/ang/crmUi.js index c8b2400ccd..fdd0cd6219 100644 --- a/ang/crmUi.js +++ b/ang/crmUi.js @@ -979,18 +979,19 @@ // Sets the one and only page title - uses CMS title if available // WARNING: Use only once per route! + // Note: Title should be plain-text only // Example:

{{ts('Hello')}}

.directive('crmUiTitle', function($timeout) { return { link: function(scope, $el, attrs) { function update() { $timeout(function() { - var newTitle = $el.html(); - document.title = $('title').html().replace(pageTitle, newTitle); + var newTitle = $el.text(); + document.title = $('title').text().replace(pageTitle, newTitle); // If the CMS has already added title markup to the page, use it $('h1').not('.crm-container h1').each(function() { - if (_.trim($(this).html()) === _.trim(pageTitle)) { - $(this).html(newTitle); + if (_.trim($(this).text()) === _.trim(pageTitle)) { + $(this).text(newTitle); $el.hide(); } }); @@ -1000,7 +1001,7 @@ scope.$watch(function() {return $el.html();}, update); } - } + }; }) .run(function($rootScope, $location) {