Skip to content

Commit 300a52d

Browse files
authored
Merge pull request #1224 from Patternslib/improvements
maint(core registry): Simplify pattern scanning filter.
2 parents 1dfede0 + 43c7255 commit 300a52d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/core/registry.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,14 @@ const registry = {
180180
);
181181
matches = matches.filter((el) => {
182182
// Filter out patterns:
183-
// - with class ``.disable-patterns``
184-
// - wrapped in ``.disable-patterns`` elements
183+
// - with class ``.disable-patterns`` or wrapped within.
185184
// - wrapped in ``<pre>`` elements
186-
// - wrapped in ``<template>`` elements
185+
// - wrapped in ``<template>`` elements (not reachable anyways)
187186
return (
188-
!el.matches(".disable-patterns") &&
189-
!el?.parentNode?.closest?.(".disable-patterns") &&
187+
!el?.closest?.(".disable-patterns") &&
190188
!el?.parentNode?.closest?.("pre") &&
191-
!el?.parentNode?.closest?.("template") && // NOTE: not strictly necessary. Template is a DocumentFragment and not reachable except for IE.
192-
!el.matches(".cant-touch-this") && // BBB. TODO: Remove with next major version.
193-
!el?.parentNode?.closest?.(".cant-touch-this") // BBB. TODO: Remove with next major version.
189+
// BBB. TODO: Remove with next major version.
190+
!el?.closest?.(".cant-touch-this")
194191
);
195192
});
196193

0 commit comments

Comments
 (0)