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
ff37fe10
authored
2012-07-09 21:53:49 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Compile changes from #19.
1 parent
48ca4e77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletions
lib/rivets.js
lib/rivets.js
View file @
ff37fe1
...
...
@@ -6,6 +6,36 @@
Rivets
=
{};
if
(
!
String
.
prototype
.
trim
)
{
String
.
prototype
.
trim
=
function
()
{
return
this
.
replace
(
/^
\s\*
/
,
''
).
replace
(
/
\s\s
*$/
,
''
);
};
}
if
(
!
Array
.
prototype
.
map
)
{
Array
.
prototype
.
map
=
function
(
callback
)
{
var
A
,
O
,
T
,
k
,
len
;
if
(
this
===
null
)
{
throw
new
TypeError
(
"Can't convert "
+
this
+
" to object"
);
}
O
=
Object
(
this
);
len
=
O
.
length
>>>
0
;
if
(
typeof
callback
!==
'function'
)
{
throw
new
TypeError
(
""
+
callback
+
" is not a function"
);
}
T
=
arguments
[
1
];
A
=
new
Array
(
len
);
k
=
0
;
while
(
k
<
len
)
{
if
(
k
in
O
)
{
A
[
k
]
=
callbackfn
.
call
(
T
,
O
[
k
],
k
,
O
);
}
k
++
;
}
return
A
;
};
}
Rivets
.
Binding
=
(
function
()
{
function
Binding
(
el
,
type
,
model
,
keypath
,
formatters
)
{
...
...
@@ -40,7 +70,11 @@
this
.
set
(
Rivets
.
config
.
adapter
.
read
(
this
.
model
,
this
.
keypath
));
}
if
(
_ref
=
this
.
type
,
__indexOf
.
call
(
bidirectionals
,
_ref
)
>=
0
)
{
return
this
.
el
.
addEventListener
(
'change'
,
this
.
publish
);
if
(
window
.
addEventListener
)
{
return
this
.
el
.
addEventListener
(
'change'
,
this
.
publish
);
}
else
{
return
this
.
el
.
attatchEvent
(
'change'
,
this
.
publish
);
}
}
};
...
...
Please
register
or
sign in
to post a comment