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
d1af20dd
authored
2012-05-05 19:05:26 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Abandon brief underscore.js dependency.
1 parent
37ae641b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
lib/rivets.js
src/rivets.coffee
lib/rivets.js
View file @
d1af20d
// Generated by CoffeeScript 1.3.1
(
function
()
{
var
__indexOf
=
[].
indexOf
||
function
(
item
)
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
if
(
i
in
this
&&
this
[
i
]
===
item
)
return
i
;
}
return
-
1
;
};
window
.
rivets
=
(
function
()
{
var
attr
,
bidirectionalBindings
,
bindableAttributes
,
bindings
,
getInputValue
,
registerBinding
,
setAttribute
,
_fn
,
_i
,
_len
;
...
...
@@ -8,7 +9,7 @@
adapter
.
subscribe
(
context
,
keypath
,
function
(
value
)
{
return
bindings
[
type
](
el
,
value
);
});
if
(
_
.
include
(
bidirectionalBindings
,
type
)
)
{
if
(
_
_indexOf
.
call
(
bidirectionalBindings
,
type
)
>=
0
)
{
return
$
(
el
).
bind
(
'change'
,
function
()
{
return
adapter
.
publish
(
context
,
keypath
,
getInputValue
(
this
));
});
...
...
@@ -105,7 +106,7 @@
node
=
nodeMap
[
n
];
if
(
/^data-/
.
test
(
node
.
name
))
{
type
=
node
.
name
.
replace
(
'data-'
,
''
);
if
(
_
.
include
(
_
.
keys
(
bindings
),
type
)
)
{
if
(
type
in
bindings
)
{
path
=
node
.
value
.
split
(
'.'
);
context
=
path
.
shift
();
keypath
=
path
.
join
(
'.'
);
...
...
src/rivets.coffee
View file @
d1af20d
...
...
@@ -10,7 +10,7 @@ window.rivets = do ->
adapter
.
subscribe
context
,
keypath
,
(
value
)
->
bindings
[
type
]
el
,
value
if
_
.
include
bidirectionalBindings
,
type
if
type
in
bidirectionalBindings
$
(
el
).
bind
'change'
,
->
adapter
.
publish
context
,
keypath
,
getInputValue
(
this
)
...
...
@@ -67,7 +67,7 @@ window.rivets = do ->
if
/^data-/
.
test
node
.
name
type
=
node
.
name
.
replace
'data-'
,
''
if
_
.
include
_
.
keys
(
bindings
),
type
if
type
of
bindings
path
=
node
.
value
.
split
'.'
context
=
path
.
shift
()
keypath
=
path
.
join
'.'
...
...
Please
register
or
sign in
to post a comment