From dd8e04c6f41b4b0bcc5f8f5f07550ee15c5d9b46 Mon Sep 17 00:00:00 2001 From: Dan Levy <397632+justsml@users.noreply.github.com> Date: Sun, 28 Jan 2018 14:21:01 -0700 Subject: [PATCH] Cleans HTML before setting document.title (#946) Fixes https://github.com/lord/slate/issues/945 --- source/javascripts/app/_toc.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/javascripts/app/_toc.js b/source/javascripts/app/_toc.js index f1937bc..bcdd1fc 100644 --- a/source/javascripts/app/_toc.js +++ b/source/javascripts/app/_toc.js @@ -3,6 +3,7 @@ ;(function () { 'use strict'; + var htmlPattern = /<[^>]*>/g; var loaded = false; var debounce = function(func, waitTime) { @@ -66,6 +67,7 @@ } var $best = $toc.find("[href='" + best + "']").first(); + var joinedTitle = $best.data("title") + " – " + originalTitle; if (!$best.hasClass("active")) { // .active is applied to the ToC link we're currently on, and its parent