@web-atoms/core 2.2.98 → 2.2.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,18 +6,25 @@ export class AncestorEnumerator {
6
6
  let start = e?.parentElement;
7
7
  while (start) {
8
8
  if(filter(start)) {
9
- return start;
9
+ return start as HTMLElement;
10
10
  }
11
11
  start = start.parentElement;
12
12
  }
13
13
  }
14
14
 
15
+ /**
16
+ * Finds the parent element that matches given selector. It does not
17
+ * return element that contains the selector.
18
+ * @param e target Element
19
+ * @param selector selector to match
20
+ * @returns
21
+ */
15
22
  public static findSelector(e: HTMLElement, selector: string) {
16
23
  let start = e?.parentElement;
17
24
  while (start) {
18
- const found = start.querySelector(selector);
25
+ const found = start.matches(selector);
19
26
  if(found) {
20
- return found;
27
+ return start as HTMLElement;
21
28
  }
22
29
  start = start.parentElement;
23
30
  }