-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I really enjoy using pseudo-window
as an alternative to manually adding and destroying the top level event listeners. The additional support for document and body tags got me thinking about where else the component could go. What do you think about expanding the element targeting further and the having the component be a convenient way to target any html element outside the scope of the current component?
As an example:
// Could still default to targeting window as a way to hint at
// the intended / most common usage. ditto is a fun working
// title. But something not window specific might be good.
<ditto
@keydown="onKey"
/>
<ditto
target="document"
@touchmove.prevent
>
<ditto
target=".canvas-wrapper'
class="block"
>
One scenario where the expanded targeting could be useful is if you run your Vue app alongside other non-Vue code, and targeting this other code requires reaching in to the DOM manually anyway. I don't have a specific use case.
Not sure if opening the door to bad practices around event handling is worth the trade-off to support the edge case of non-Vue app code.