aurelia icon indicating copy to clipboard operation
aurelia copied to clipboard

Allow AttrSyntax to carry parsed parts information

Open bigopon opened this issue 5 years ago • 2 comments

🙋 Feature Request

At the moment, attr syntax does not allow reuse, or support multiple parts. An example of this is the following:

<div click.trigger.stop.prevent="invadeClick($event)"></div>
or
<div click.trigger:stop:prevent="invadeClick($event)"></div>
or
<div @click.stop.prevent="invalidClick($event)"></div>

With attr pattern:

  { pattern: 'PART.trigger.PART.PART', symbols: '.' },

The context of this is there needs to be some way to declare many configuration options of for attaching an event listener. An example of this is Chrome now makes touch event non cancellable by default, unless you explicitly declare passive: false.

Maybe we could just extend AttrSyntax, or maybe we could do something else, but it seems having an extra property parts on attrsyntax seems to be the simplest option.

bigopon avatar Sep 23 '20 12:09 bigopon

@bigopon

Weird, I asked it before https://github.com/aurelia/aurelia/issues/796 Fred told me it is possible with current @bindingCommand extensibility point.

HamedFathi avatar Sep 23 '20 12:09 HamedFathi

@HamedFathi thanks for the reminder. From the current shapes of binding command & AttrSyntax, it feels to me it's either not supported, or not dynamic enough, you will need to define a binding command for all combination of attr syntax. Imagine the following:

<div click.trigger.stop.prevent="invadeClick($event)"></div>
<div click.trigger.prevent.stop="invadeClick($event)"></div>

they probably should be treated the same

bigopon avatar Sep 23 '20 14:09 bigopon

@bigopon If the major problem area of this issue is the listener binding, then I would suggest closing this as a duplicate of #796, and provide out-of-the-box solutions that handle this by providing fitting attribute patterns and/or binding command.

Sayan751 avatar Dec 29 '23 11:12 Sayan751