ZPT-JS reference - Configuration - notRemoveGeneratedTags

Syntax

notRemoveGeneratedTags ::= a boolean value
                

Description

The notRemoveGeneratedTags sets whether ZPT-JS will remove the previously generated tags before processing. It must be a boolean value. The default value is false (to remove them).

ZPT-JS generates new HTML tags if the template uses:

Examples

We are goint to invoke ZPT-JS twice, setting notRemoveGeneratedTags to true the second time:

"use strict";

var zpt = require( 'zpt' );

var dictionary = {
    someNumbers: [ 10, 20, 30 ]
};

// First execution: add 10/20/30
zpt.run({
    root: document.body,
    dictionary: dictionary
});

[ your code here ]

// Second execution: add 40/50
dictionary.someNumbers = [ 40, 50 ];

zpt.run({
    notRemoveGeneratedTags: true
});
                

The template:

<body>
    <ol>
        <li data-repeat="c someNumbers">
            Iterating element <span data-content="c">a number</span>
        </li>
    </ol>
</body>
                

After the first invokation the visible HTML document would be:

<body>
    <ol>
        <li>
            Iterating element <span data-content="c">10</span>
        </li>
        <li>
            Iterating element <span data-content="c">20</span>
        </li>
        <li>
            Iterating element <span data-content="c">30</span>
        </li>
    </ol>
</body>
                

After the second invokation:

<body>
    <ol>
        <li>
            Iterating element <span data-content="c">10</span>
        </li>
        <li>
            Iterating element <span data-content="c">20</span>
        </li>
        <li>
            Iterating element <span data-content="c">30</span>
        </li>
        <li>
            Iterating element <span data-content="c">40</span>
        </li>
        <li>
            Iterating element <span data-content="c">50</span>
        </li>
    </ol>
</body>
                

If we don't set the notRemoveGeneratedTags value in the second invokation (as usually), the result is:

<body>
    <ol>
        <li>
            Iterating element <span data-content="c">40</span>
        </li>
        <li>
            Iterating element <span data-content="c">50</span>
        </li>
    </ol>
</body>