✨ A no-runtime dependency lib for text highlighting & persistence on any website ✨🖍️
888
stars
144
forks
source link
fix(classname): keep the only latest classname when wrapping a partial node or an overlap node #82
Closed
alienzhou closed 3 years ago
After changing the
className
by.setOption()
, highlighting a node still retains its existing classnames.https://github.com/alienzhou/web-highlighter/blob/576508afd218d10218160d89b7b0ab048540d6dc/src/painter/dom.ts#L234-L236
https://github.com/alienzhou/web-highlighter/blob/576508afd218d10218160d89b7b0ab048540d6dc/src/painter/dom.ts#L278
As a result it may hit a wrong style rule.
With styles below
The wrappers with
class="yellow blue"
andclass="blue yellow"
look the same. But they should be different.