Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Improve no-child-traversal-in-connectedcallback #130

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/rules/no-child-traversal-in-connectedcallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FooBarElement extends HTMLElement {
if (button) {
button.disabled = true
}
}).observe(this)
}).observe(this, {childList: true})
}
}
```
Expand All @@ -52,3 +52,5 @@ class FooBarElement extends HTMLElement {
## When Not To Use It

If you are comfortable with the edge cases of DOM traversal directly in the `connectedCallback` then you can disable this rule.

It may also be necessary to disable the rule when the custom element is appended to the DOM via JavaScript like for instance the Vue framework, which appends the element including all children at once and a `MutationObserver` would not receive any `childList` mutations in such cases.
silverwind marked this conversation as resolved.
Show resolved Hide resolved