Skip to content

Commit fc04849

Browse files
Merge pull request #19059 from Snuffleupagus/DOMFilterFactory-rm-_hcmCache
Improve clean-up of `#_hcmCache`-data in `DOMFilterFactory.prototype.destroy`
2 parents bc91985 + 4c57ec4 commit fc04849

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/display/filter_factory.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -423,17 +423,18 @@ class DOMFilterFactory extends BaseFilterFactory {
423423
}
424424

425425
destroy(keepHCM = false) {
426-
if (keepHCM && this.#hcmCache.size !== 0) {
426+
if (keepHCM && this.#_hcmCache?.size) {
427427
return;
428428
}
429-
if (this.#_defs) {
430-
this.#_defs.parentNode.parentNode.remove();
431-
this.#_defs = null;
432-
}
433-
if (this.#_cache) {
434-
this.#_cache.clear();
435-
this.#_cache = null;
436-
}
429+
this.#_defs?.parentNode.parentNode.remove();
430+
this.#_defs = null;
431+
432+
this.#_cache?.clear();
433+
this.#_cache = null;
434+
435+
this.#_hcmCache?.clear();
436+
this.#_hcmCache = null;
437+
437438
this.#id = 0;
438439
}
439440

0 commit comments

Comments
 (0)