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
77351bb8
authored
2012-06-29 19:02:43 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Expose a register function to register new custom binding routines.
1 parent
2cad87fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
lib/rivets.js
src/rivets.coffee
lib/rivets.js
View file @
77351bb
...
...
@@ -76,6 +76,9 @@
bidirectionals
=
[
'value'
,
'checked'
,
'unchecked'
,
'selected'
,
'unselected'
];
rivets
=
{
register
:
function
(
routine
,
routineFunction
)
{
return
bindings
[
routine
]
=
routineFunction
;
},
bind
:
function
(
el
,
adapter
,
contexts
)
{
var
attribute
,
context
,
keypath
,
node
,
path
,
type
,
_i
,
_len
,
_ref
,
_results
;
if
(
contexts
==
null
)
{
...
...
src/rivets.coffee
View file @
77351bb
...
...
@@ -65,8 +65,12 @@ bindings =
# to propogate those changes back to the model object.
bidirectionals
=
[
'value'
,
'checked'
,
'unchecked'
,
'selected'
,
'unselected'
]
# The rivets module. Exposes a single `bind` function.
# The rivets module exposes `register` and `bind` functions to register new
# binding routines and bind contexts to DOM elements.
rivets
=
register
:
(
routine
,
routineFunction
)
->
bindings
[
routine
]
=
routineFunction
bind
:
(
el
,
adapter
,
contexts
=
{})
->
for
node
in
el
.
getElementsByTagName
'*'
for
attribute
in
node
.
attributes
...
...
Please
register
or
sign in
to post a comment