From 7565f24a8fd07b2e874e147929bdcb45b3e4af10 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 25 Oct 2015 11:50:43 -0400 Subject: [PATCH] Force page title to plain text --- ang/crmUi.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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) { -- 2.25.1