Object $p and its methods
When you load the pure.js in your page, a global variable called $p is available with the methods below.
PURE detects if you are using a JS framework in the same page(dojo, domassistant, jquery, mootools, prototype, sizzle or sly) and adds automatically the methods below to your familiar environment. i.e: $(...).render(...). Have a look at how to use PURE with your JS Framework
render
$p( html ).render( data, directives|function )
Input:
|
Output:the input DOM node html is replaced with the result of the transformation. |
See some examples or render: simple , iteration , using JS functions
compile
Use this method if you want to re-use various times the same template.
compile converts an HTML node to a JS function using a directive.
Or as with autoRender, with data and map automatically CLASS attributes.
$p( html ).compile( directives [, data] )
Input:
|
Output:function: This method compiles the HTML template to returns a JS function.
To reuse a template, the function can be passed to $p.render:
|
See an example that use compile
autoRender
autoRender automatically maps the JSON data with the CLASS attributes in the HTML.
$p( html ).autoRender( data [, directives] )
Input:
|
Output:the input DOM node html is replaced with the result of the transformation. |
See some examples: node value , iteration , attribute

