diff --git a/app/src/protyle/util/destroy.ts b/app/src/protyle/util/destroy.ts index 6c22d91df..a635e3ab7 100644 --- a/app/src/protyle/util/destroy.ts +++ b/app/src/protyle/util/destroy.ts @@ -1,14 +1,17 @@ import {hideElements} from "../ui/hideElements"; +import {isSupportCSSHL} from "../render/searchMarkRender"; export const destroy = (protyle: IProtyle) => { if (!protyle) { return; } hideElements(["util"], protyle); - protyle.highlight.markHL.clear(); - protyle.highlight.mark.clear(); - protyle.highlight.ranges = []; - protyle.highlight.rangeIndex = 0; + if (isSupportCSSHL()) { + protyle.highlight.markHL.clear(); + protyle.highlight.mark.clear(); + protyle.highlight.ranges = []; + protyle.highlight.rangeIndex = 0; + } protyle.observer?.disconnect(); protyle.observerLoad?.disconnect(); protyle.element.classList.remove("protyle");