Declaratively toggle class names
<div data-dyna-context="window.app" data-dyna-as="foo">
<span data-dyna-class="{ hightlight: this.bar(), colors: length > 1 }"></span>
<div data-dyna-context="foo.bar().baz">
<span data-dyna-class="{ hightlight: foo.bar() }"></span>
</div>
</div>
data-dyna-context
takes an expression to provide a this
evaluation context for nested data-dyna-class
attributes. Contexts may be nested arbitrarily and may optionally be named.
data-dyna-class
takes a collection of key-value pairs. Values are evaluated in the current context. Chen the value is true, the corresponding key is used as a class name for element. When the value is false, the class is removed. Keys are strings, including spaces to demarcate multiple classes ('one two'
).