e6440360 by Michael Richards

Add a data-html binding in addition to data-text. Fix typos and inconsistencies.

1 parent f4729ad0
......@@ -15,6 +15,7 @@ No contrived example here yet, but the `rivets` module is simple. It exposes a s
#### Available bindings:
- **data-text**: one-way binding that sets the node's text.
- **data-html**: one-way binding that sets the node's html content.
- **data-value**: two-way binding that sets the node's value.
- **data-show**: one-way binding that sets the node's display state.
- **data-hide**: one-way inverse binding that sets the node's display state.
......
......@@ -63,9 +63,12 @@
return setAttribute(el, 'selected', value, true);
},
unselected: function(el, value) {
return setAttribute(el, 'checked', !value, true);
return setAttribute(el, 'selected', !value, true);
},
text: function(el, value) {
return el.innerText = value || '';
},
html: function(el, value) {
return el.innerHTML = value || '';
},
value: function(el, value) {
......
......@@ -41,8 +41,10 @@ bindings =
selected: (el, value) ->
setAttribute el, 'selected', value, true
unselected: (el, value) ->
setAttribute el, 'checked', !value, true
setAttribute el, 'selected', !value, true
text: (el, value) ->
el.innerText = value or ''
html: (el, value) ->
el.innerHTML = value or ''
value: (el, value) ->
el.value = value
......