janl/mustache.js — Issue #143: Is this somehow supported in Mustache (pseudocode)?
Author: polomoshnov
Created: 2011-12-05 08:26:29+00:00
State: open

Is this somehow supported in Mustache (pseudocode)?:

// data & template
data = { content: 'lorem ipsum' }
template = '

{{content}}

';
// mustache it
widget = mustache(template, data);
// appends

lorem ipsum

to the body with the help of jQuery
$('body').append(widget.html);
// logs lorem ipsum into the console
console.log(widget.get('content'));
// sets new content
widget.set('content', 'hello world');
// logs hello world into the console
console.log(widget.get('content'));
// logs hello world into the console
console.log($('#widget').text());