Skip to content

Commit d0ffa6f

Browse files
committed
fix button text appearing in title of sidebar menu
1 parent 1b23c92 commit d0ffa6f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

themes/vue/source/js/common.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,16 @@
252252

253253
function makeLink (h) {
254254
var link = document.createElement('li')
255-
var text = h.textContent.replace(/\(.*\)$/, '')
255+
window.arst = h
256+
var text = [].slice.call(h.childNodes).map(function (node) {
257+
if (node.nodeType === Node.TEXT_NODE) {
258+
return node.nodeValue
259+
} else if (['CODE', 'SPAN'].indexOf(node.tagName) !== -1) {
260+
return node.textContent
261+
} else {
262+
return ''
263+
}
264+
}).join('').replace(/\(.*\)$/, '')
256265
link.innerHTML =
257266
'<a class="section-link" data-scroll href="#' + h.id + '">' +
258267
htmlEscape(text) +

0 commit comments

Comments
 (0)