Skip to content

Instantly share code, notes, and snippets.

@amdgigabyte
Created June 11, 2014 11:36
Show Gist options
  • Save amdgigabyte/891ec8f567b1030b79eb to your computer and use it in GitHub Desktop.
Save amdgigabyte/891ec8f567b1030b79eb to your computer and use it in GitHub Desktop.
input {
width:500px;
}
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="KISSY XTemplate Test" />
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://g.tbcdn.cn/kissy/k/1.4.3/seed.js"></script>
</head>
<body>
<div class="input">
~!@#$%^&amp;*()_+{}/&quot;test&#39;
</div>
<div class="result">
</div>
<p class="result2">
</p>
<input type="text" class="test">
<script>
KISSY.use('dom,xtemplate', function (S,DOM, XTemplate) {
var aa = '<h2><p>"</p></h2>';
var tpl = '{{titlewithH2}} and {{{titlewithH2}}}';
var tpl2 = '<input type="text" class="result3" value="{{titlewithH2}} and {{{titlewithH2}}}">';
var data = {
titlewithH2: '~!@#$%^&amp;*()_+{}/&quot;test&#39;',
};
var render = new XTemplate(tpl).render(data);
DOM.get('.result').innerHTML = '<div>' + render + '</div>';
DOM.get('.result2').innerHTML = '<div>' + new XTemplate(tpl2).render(data) + '</div>';
DOM.val('.test',new XTemplate(tpl).render(data));
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment