Subscribe on changes!

Custom Element, Emit CustomEvent, allow bubbles

avatar
Jan 30th 2023

What problem does this feature solve?

The current implementation of Custom Elements lets defined emits dispatch a CustomEvent with the arg put in details. However there is no way to allow these events to bubble.

Current code snippet from the sourcecode:

new CustomEvent(event, {
  detail: args
})

As described in the documentation here: https://vuejs.org/guide/extras/web-components.html#events

However there is no way to define the bubbles property in the CustomEvent.

What does the proposed API look like?

It could be as simple as checking if there is a property called bubbles in the args and pass that in, otherwise default to false.

avatar
Feb 14th 2023

If we could easily access the root html element in SFC we might not need to use Vue's special event handling