Modstache.fill
Assigns data properties. Works on an HTML string or DOM fragment. Returns the filled DOM fragment.
API call
var targetFragment = Modstache.fill(target:HTML string or DOM fragment, data:object, optional options:object);
Returns The passed DOM fragment is modified and returned or a new fragment is created from the passed HTML.
Example of Modstache.fill with HTML string
var html = "<div>{{value}}</div>";
var data = { value: 'Testing!' };
var fragment = Modstache.fill(html, data);
// fragment contains DOM elements "<div>Testing!</div>"
Example of Modstache.fill with DOM fragment
var html = '<div {}="value">This is replaced</div>';
var template = document.createElement("template");
var data = { value: 'Hello' };
template.innerHTML = html;
Modstache.fill(template.content, data, { removeStache: true });
// template.innerHTML is "<div>Hello</div>"