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 ...@@ -15,6 +15,7 @@ No contrived example here yet, but the `rivets` module is simple. It exposes a s
15 #### Available bindings: 15 #### Available bindings:
16 16
17 - **data-text**: one-way binding that sets the node's text. 17 - **data-text**: one-way binding that sets the node's text.
18 - **data-html**: one-way binding that sets the node's html content.
18 - **data-value**: two-way binding that sets the node's value. 19 - **data-value**: two-way binding that sets the node's value.
19 - **data-show**: one-way binding that sets the node's display state. 20 - **data-show**: one-way binding that sets the node's display state.
20 - **data-hide**: one-way inverse binding that sets the node's display state. 21 - **data-hide**: one-way inverse binding that sets the node's display state.
......
...@@ -63,9 +63,12 @@ ...@@ -63,9 +63,12 @@
63 return setAttribute(el, 'selected', value, true); 63 return setAttribute(el, 'selected', value, true);
64 }, 64 },
65 unselected: function(el, value) { 65 unselected: function(el, value) {
66 return setAttribute(el, 'checked', !value, true); 66 return setAttribute(el, 'selected', !value, true);
67 }, 67 },
68 text: function(el, value) { 68 text: function(el, value) {
69 return el.innerText = value || '';
70 },
71 html: function(el, value) {
69 return el.innerHTML = value || ''; 72 return el.innerHTML = value || '';
70 }, 73 },
71 value: function(el, value) { 74 value: function(el, value) {
......
...@@ -41,8 +41,10 @@ bindings = ...@@ -41,8 +41,10 @@ bindings =
41 selected: (el, value) -> 41 selected: (el, value) ->
42 setAttribute el, 'selected', value, true 42 setAttribute el, 'selected', value, true
43 unselected: (el, value) -> 43 unselected: (el, value) ->
44 setAttribute el, 'checked', !value, true 44 setAttribute el, 'selected', !value, true
45 text: (el, value) -> 45 text: (el, value) ->
46 el.innerText = value or ''
47 html: (el, value) ->
46 el.innerHTML = value or '' 48 el.innerHTML = value or ''
47 value: (el, value) -> 49 value: (el, value) ->
48 el.value = value 50 el.value = value
......