Re: Proposal for merging <signal/> into <dispatch/>

I am not a huge fan of the `to` attribute, so I am looking for other
solutions :)

DOM events with the Shadow DOM have an attribute called `composed` [1].
When that attribute is set to `true` and the event bubbles, it does so
through the Shadow DOM root. We could follow this and add a
`composed="true"` attribute on `dispatch` instead of `to="parent"`.

Now for the other way around, that is dispatching an event in the embedding
form to the embedded form, I don't find a corresponding mechanism for the
Shadow DOM, which is crazy.

We could consider attaching a listener with a special observer within the
embedded form, something like:

    <action
        event="my-custom-event-from-the-outside"
        observer="#host"/>

Our implementation already makes use of values starting with `#`, namely:
[2]

    event="#all"
    observer="#document"
    observer="#preceding-sibling"
    target="#observer"

-Erik

[1] https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
[2] https://doc.orbeon.com/xforms/events/events-extensions-other


On Tue, Nov 13, 2018 at 6:25 AM Steven Pemberton <steven.pemberton@cwi.nl>
wrote:

> Add @to attribute to dispatch: (we can discuss the choice of name)
>
>    to = targetid | parent | control
>    Value 'targetid' is default
>
> The attribute has the following effects:
>    to="targetid", targetid="..." behaviour is as now.
>    to="control", targetid="id of control element", event is dispatched to
> first model of embedded control
>    to="parent", (targetid is ignored), event is dispatched to embedding
> control element
>
> Examples:
>
>    <dispatch name="tick" targetid="clock"/>
>    <dispatch name="tick" to="targetid" targetid="clock"/> (has same
> effect
> as above)
>    <dispatch name="reset" to="control" targetid="game"/>
>    <dispatch name="finished" to="parent"/>
>
> You might prefer:
>
>    <dispatch name="reset" to="control" control="game"/>
>
> Steven
>
>

Received on Wednesday, 21 November 2018 06:59:17 UTC