Feature Idea - :ancestor action option
NakajimaTakuya opened this issue · comments
nakajima a.k.a. nazomikan commented
There are many cases where a child element wants to listen to events of its ancestor element and act on them.
In such cases, it is common to use @document
or @window
.
However, it is often necessary to care whether or not the event was originated by its own ancestor.
How about providing some assurance of that in the action option?
If it looks good I will make a PR.
code
app.registerActionOption('ancestor', ({ event, element }) => {
return event.target.contains(element);
});
syntax
data-action="disclousre:open@document->content-loader#load:ancestor:once"
example: