mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
use closest
This commit is contained in:
@@ -596,13 +596,7 @@ export default class WaSelect extends WebAwesomeFormAssociatedElement {
|
||||
|
||||
// If no direct option was provided, find the option from the event path
|
||||
if (!option) {
|
||||
const path = event.composedPath();
|
||||
const tagElement = path.find(
|
||||
el =>
|
||||
el instanceof HTMLElement &&
|
||||
(el.tagName.toLowerCase() === 'wa-tag' ||
|
||||
(el instanceof HTMLElement && el.hasAttribute('part') && el.getAttribute('part')?.includes('tag'))),
|
||||
);
|
||||
const tagElement = (event.target as Element).closest('wa-tag[part~=tag]');
|
||||
|
||||
if (tagElement) {
|
||||
// Find the index of this tag among all tags
|
||||
|
||||
Reference in New Issue
Block a user