The + notation

By default a directive will replace the selected element node or attribute value.

Sometimes we want to keep the current value and append or prepend the result of the directive.

This is particularly useful if a directive needs to act on classes while auto-rendering.
As the class is used to map the HTML and the JSON, we may not want to replace the current value.

Append / Prepend notation

The + symbol before or after the selector string indicates if we want to append or prepend the value.

  • 'tr@class': rowDecorator
    Will replace the attribute class of the TR by the value returned by the function rowDecorator
  • 'tr@class+': rowDecorator
    Will append the current value of the class attribute of the TR by the value returned by the function rowDecorator
  • '+tr@class': rowDecorator
    Will prepend the current value of the class attribute of the TR by the value returned by the function rowDecorator

This apply for autoRender too:

The class site@href+ will append the value of 'site' at the end of the 'href' attribute.

While site@href will replace it or add it