Slow highlighting in Firefox
问题 We need to add anchors and highlights for some keywords/sentences in the html page. It turns out the highlighting is really slow in Firefox. In the following code, all ranges which need to be highlighted are stored in array hiliteRanges : for (var i = 0; i < hiliteRanges.length; i++){ document.designMode = "on"; var selHilites = window.getSelection(); if (selHilites.rangeCount > 0) selHilites.removeAllRanges(); selHilites.addRange(hiliteRanges[i]); var anchorId = 'index'+i; var insertedHTML =