Root scope behavior
root points to the top of the current behavior tree, not the document root.
What is the root?
When you nest behaviors, the outer behavior becomes the root of that tree. All nested behaviors share that root scope.
Example
behavior .tabs {
active: "one";
behavior .tab {
on click() { root.active = @data-id; }
}
}
The .tab elements update active on the .tabs scope.
Common mistakes
rootis notdocument.body.- If you need DOM root access, use a query instead.