Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
rivets
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
e6440360
authored
2012-05-13 14:23:31 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add a data-html binding in addition to data-text. Fix typos and inconsistencies.
1 parent
f4729ad0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
README.md
lib/rivets.js
src/rivets.coffee
README.md
View file @
e644036
...
...
@@ -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.
...
...
lib/rivets.js
View file @
e644036
...
...
@@ -63,9 +63,12 @@
return
setAttribute
(
el
,
'selected'
,
value
,
true
);
},
unselected
:
function
(
el
,
value
)
{
return
setAttribute
(
el
,
'
check
ed'
,
!
value
,
true
);
return
setAttribute
(
el
,
'
select
ed'
,
!
value
,
true
);
},
text
:
function
(
el
,
value
)
{
return
el
.
innerText
=
value
||
''
;
},
html
:
function
(
el
,
value
)
{
return
el
.
innerHTML
=
value
||
''
;
},
value
:
function
(
el
,
value
)
{
...
...
src/rivets.coffee
View file @
e644036
...
...
@@ -41,8 +41,10 @@ bindings =
selected
:
(
el
,
value
)
->
setAttribute
el
,
'selected'
,
value
,
true
unselected
:
(
el
,
value
)
->
setAttribute
el
,
'
check
ed'
,
!
value
,
true
setAttribute
el
,
'
select
ed'
,
!
value
,
true
text
:
(
el
,
value
)
->
el
.
innerText
=
value
or
''
html
:
(
el
,
value
)
->
el
.
innerHTML
=
value
or
''
value
:
(
el
,
value
)
->
el
.
value
=
value
...
...
Please
register
or
sign in
to post a comment