mirror of
https://github.com/danbulant/api_docs
synced 2026-05-19 04:08:40 +00:00
Cleans HTML before setting document.title (#946)
Fixes https://github.com/lord/slate/issues/945
This commit is contained in:
parent
55cbe85ca8
commit
dd8e04c6f4
1 changed files with 3 additions and 1 deletions
|
|
@ -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 <ul>s selected by tocListSelector
|
||||
// .active-expanded is applied to the ToC links that are parents of this one
|
||||
|
|
@ -77,7 +79,7 @@
|
|||
$toc.find(tocListSelector).filter(":not(.active)").slideUp(150);
|
||||
$toc.find(tocListSelector).filter(".active").slideDown(150);
|
||||
// TODO remove classnames
|
||||
document.title = $best.data("title") + " – " + originalTitle;
|
||||
document.title = joinedTitle.replace(htmlPattern, '');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue