ZPT-JS reference - Configuration - target

Syntax

target         ::= target_element || Array of target_element
target_element ::= a DOM node
                

Description

The target is used to define the node or nodes where ZPT-JS will search its custom attributes in a partial render. As root it can be a simple DOM node or an array of DOM nodes.

It is very similar to root. The difference is that targets refers to updates of nodes using partial renders. The first invokation of ZPT-JS needs a root definition.

Examples

Using the configuration option:

"use strict";

var zpt = require( 'zpt' );

var dictionary = {
    ...
};

// First execution: render the body
zpt.run({
    root: document.body,
    dictionary: dictionary
});

[ your code here ]

// Second execution: render only some elements
zpt.run({
    command: 'partialRender',
    target: [ 
        document.getElementById( 'id1' ), 
        document.getElementById( 'id2' )
    ]
});