That’s right. Even though you don’t have to declare the actions in a static array you define the actions somehow statically by writing the actions in the controller
I agree, but the same applies also for data-target. Either way, I think it should just be consistent overall. But I also tend to like the 1.1 syntax more.
The biggest problem I had in adopting Stimulus was naming conventions. After I got the first controller working, I’d move to the next one and it would not work! Because I screwed up the naming convention. I forgot to put the dot between the controller name and the target, or forget the controller js file name was camel cased, etc etc.
Right or wrong I started to camel case my controller name. My understanding about data- is that anything after data- is valid so
this worked (slim template):
form#validate will always be invoked before modal#expand. If form#validate calls event.stopImmediatePropagation(), modal#expand won’t be invoked.
Changing to a scoped-by-controller-indentifier HTML syntax would make the ordering ambiguous and impossible to declare explicitly.
Here’s another way to think about the syntax changes in 2.0. Now, all of the properties you define as static … lines in your controllers follow the same data-[identifier]-* naming convention in your HTML: