问题
I've been using a chrome extension to select sentences on the page. I were recommended to used the library Mark.js to avoid destroying event listener and or element inside elements.
var markInstance = new Mark(document.body);
var options = {
element: `mark`,
className: `highlight-${position}`,
exclude: ['.ignore'],
separateWordSearch: false,
debug: true,
};
markInstance.mark(sentence, options);
I've been having problems with sentences that contains hyperlinks Examples:
Learn more about the various fees you may incur here.
来源:https://stackoverflow.com/questions/62328518/mark-js-anchor-tag-issue