Skip to content

Instantly share code, notes, and snippets.

@csuwildcat
Created June 28, 2013 18:38
Show Gist options
  • Save csuwildcat/5886961 to your computer and use it in GitHub Desktop.
Save csuwildcat/5886961 to your computer and use it in GitHub Desktop.
<x-control name="comment">
<template>
<div class="comment">
<label>User: <span class="user"></span></label>
<p></p>
<br />
<span class="date"></span>
<button>Update</button>
<ul></ul>
</div>
</template>
<style>
.comment {
padding: 10px;
border-bottom: 1px solid #999;
}
.comment label {
font-weight: bold;
}
</style>
<script type="control">
this.addListeners({
'click:delegate(button)': function(){
return {
'comment': 'Look ma, I just updated myself!'
}
}
});
this.addBindings({
'user:query(span.user)': function(value){
this.innerHTML = value;
},
'comment:query(div > p)': function(value){
this.innerHTML = value;
},
'date:query(span.date)': function(value){
this.innerHTML = value;
},
'replies:query(x-repeater)': function(value){
this.foo = value;
}
});
</script>
</x-control>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment