Rendering with directives
Declare manually the actions you want PURE to take.
To change the value of an HTML node:
var json = { 'animal' : 'cat' };
var directive = { 'span' : 'animal' };
- 'span' means: select the tag SPAN
- 'animal' means: set the node value of the SPAN to the value of the property 'animal' --> 'cat'
Sub-properties can be accessed too, with the following notations obj.prop.subProp, ie: animal.name
If the value returned is undefined, it will be converted to a empty string.
To change or add an HTML attribute:
var json = { site : 'http://beebole.com' };var directive = { 'a@href' : 'site' };
- 'a@href' means: select the attribute 'href' from the tag 'a', and
- 'site' means: place the value of the property site in that attribute.
If the value returned is an empty string the attribute will be removed.

