Skip to content

Commit

Permalink
"Stimulus targets nesting" check works with multiple controller defin…
Browse files Browse the repository at this point in the history
…ition
  • Loading branch information
leonvogt committed Nov 4, 2024
1 parent f33a7d2 commit b16e12d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/diagnostics_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class DiagnosticsChecker {
const dataSelector = `data-${controllerId}-target`
const targetElements = document.querySelectorAll(`[${dataSelector}`)
targetElements.forEach((element) => {
const parent = element.closest(`[data-controller="${controllerId}"]`)
const parent = element.closest(`[data-controller~="${controllerId}"]`)
if (!parent) {
const targetName = element.getAttribute(`${dataSelector}`)
this.printWarning(`The Stimulus target '${targetName}' is not inside the Stimulus controller '${controllerId}'`)
Expand Down

0 comments on commit b16e12d

Please sign in to comment.