Commit 0414c6ad authored by jobicarter's avatar jobicarter

[FIX] fixed auto toc showing blank anchors in FF due to element.innerText use

parent 3d3e1e39
......@@ -126,12 +126,12 @@ $.buildAutoToc = function () {
//grab the whole header element to show as the anchor text
// aText = $.trim(currentHeader.innerHTML); //trim incase inner html is text (if <hx>text</hx>)
aText = $.trim(currentHeader.innerText);
aText = $.trim(currentHeader.textContent);
//generate and set id if necessary (if element does not already have an id, create one)
if (!currentHeader.id){
//set the id to the the inner text of the header, with underscores instead of "<", ">", and spaces (" "). Increment Id checks if the ID has been assigned yet, and if so, increments the Id with a number at the end of the id name
id = processId(currentHeader.innerText.trim().replace(/ /g, "_").replace(/&lt;/g, "_").replace(/&gt;/g, "_"));
id = processId(currentHeader.textContent.trim().replace(/ /g, "_").replace(/&lt;/g, "_").replace(/&gt;/g, "_"));
//set the element's id to the constructed ID
currentHeader.setAttribute("id", id);
......@@ -261,4 +261,4 @@ $.buildAutoToc = function () {
}
}
};
$.buildAutoToc();
\ No newline at end of file
$.buildAutoToc();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment