hotwired / stimulus-site

stimulus.hotwired.dev web site
18 stars 20 forks source link

SyntaxError highlight code example in doc #47

Open zhisme opened 9 months ago

zhisme commented 9 months ago

I believe the example code is wrong.

highlight: function(event) {
  event.stopImmediatePropagation()
  // ...
}

we are inside class, but here it is written like object property and thus leading to SyntaxError: Unexpected identifier 'highlight'

should be corrected like in all other examples to class function definition

highlight(event) {
  event.stopImmediatePropagation()
  // ...
}

Stumbled upon working with documentation and copypasting to my project.

marcoroth commented 9 months ago

You are right 👍🏼

Feel free to open a PR on https://github.com/hotwired/stimulus and fix it in this file: https://github.com/hotwired/stimulus/blob/bafb739401f54fed1b70869410979b5acd43f487/docs/reference/actions.md#multiple-actions