tinro icon indicating copy to clipboard operation
tinro copied to clipboard

Use action parameters

Open Prinzhorn opened this issue 3 years ago • 4 comments

I find it very odd to use exact or active-class attributes (even with data-*). This feels like jQuery-esque 2008 era code and not like Svelte.

Can we migrate this to:

<a href="/page" use:active={{exact: true, activeClass: 'super-active'}}>Link</a>

?

Edit: This would even allow for a third argument, a function that returns a boolean. So that you can implement custom logic.

<a href="/page" use:active={{test: route => route.path.includes('some-token')}}>Link</a>

Prinzhorn avatar Aug 18 '21 15:08 Prinzhorn

For tinro-ignore I suggest a use:ignore action that handles this behind the scenes. Either by adding a data-tinro-ignore for you or by keeping a WeakSet<Node> that you can test against inside aClickListener (this would not pollute the DOM with an unnecessary attribute)

Prinzhorn avatar Aug 18 '21 15:08 Prinzhorn

I like attributes notation more. Mustaches looks dirty.

AlexxNB avatar Aug 18 '21 16:08 AlexxNB

Interesting, but Svelte uses Mustaches all over the place?

Prinzhorn avatar Aug 18 '21 16:08 Prinzhorn

I mean double curves

AlexxNB avatar Aug 18 '21 18:08 AlexxNB