Skip to content

Commit

Permalink
Merge pull request #1224 from Patternslib/improvements
Browse files Browse the repository at this point in the history
maint(core registry): Simplify pattern scanning filter.
  • Loading branch information
thet authored Jan 13, 2025
2 parents 1dfede0 + 43c7255 commit 300a52d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/core/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,14 @@ const registry = {
);
matches = matches.filter((el) => {
// Filter out patterns:
// - with class ``.disable-patterns``
// - wrapped in ``.disable-patterns`` elements
// - with class ``.disable-patterns`` or wrapped within.
// - wrapped in ``<pre>`` elements
// - wrapped in ``<template>`` elements
// - wrapped in ``<template>`` elements (not reachable anyways)
return (
!el.matches(".disable-patterns") &&
!el?.parentNode?.closest?.(".disable-patterns") &&
!el?.closest?.(".disable-patterns") &&
!el?.parentNode?.closest?.("pre") &&
!el?.parentNode?.closest?.("template") && // NOTE: not strictly necessary. Template is a DocumentFragment and not reachable except for IE.
!el.matches(".cant-touch-this") && // BBB. TODO: Remove with next major version.
!el?.parentNode?.closest?.(".cant-touch-this") // BBB. TODO: Remove with next major version.
// BBB. TODO: Remove with next major version.
!el?.closest?.(".cant-touch-this")
);
});

Expand Down

0 comments on commit 300a52d

Please sign in to comment.