web-highlighter icon indicating copy to clipboard operation
web-highlighter copied to clipboard

会高亮实例化根元素以外的元素。

Open ddddderek opened this issue 3 years ago • 2 comments

实例化的时候,传入容器根元素。

错误:划线根元素以外的元素,也会导致高亮。

期望:只应该高亮容器根元素的后代节点。

复现:连接 展示的网站也有此问题。

ddddderek avatar Jul 11 '22 07:07 ddddderek

也许这可能会有所帮助,我修复它的方法是在初始化期间设置 exceptSelectors: [] 选项以排除外部元素我还确保用作容器的 DOM 元素已添加到页面中,因为如果找不到它并且它是 等于 null,荧光笔将使用整个文档作为后备。

Maybe this could help, the way I fixed it is by setting the exceptSelectors: [] option during initialisation to exclude external elements also I made sure the DOM element used as container has been added to the page because if it is not found and it is equal to null, the highlighter will use the whole document as fallback.

ahicham-xyz avatar Jul 11 '22 13:07 ahicham-xyz

传入根元素的HTMLElement但是依然会高亮根元素之外的节点

qscgu23 avatar Mar 21 '23 08:03 qscgu23