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
f5528f7a
authored
2013-04-07 17:06:37 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #144 from mikeric/jquery-implementations-for-input
jQuery implementations for input
2 parents
169311ac
fd434ad2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
src/rivets.coffee
src/rivets.coffee
View file @
f5528f7
...
...
@@ -251,12 +251,19 @@ unbindEvent = (el, event, fn) ->
event
=
'on'
+
event
el
.
detachEvent
event
,
fn
#
Returns the current input value for the specified element
.
#
Cross-browser input value getter
.
getInputValue
=
(
el
)
->
switch
el
.
type
when
'checkbox'
then
el
.
checked
when
'select-multiple'
then
o
.
value
for
o
in
el
when
o
.
selected
else
el
.
value
if
window
.
jQuery
?
el
=
jQuery
el
switch
el
[
0
].
type
when
'checkbox'
then
el
.
is
':checked'
else
el
.
val
()
else
switch
el
.
type
when
'checkbox'
then
el
.
checked
when
'select-multiple'
then
o
.
value
for
o
in
el
when
o
.
selected
else
el
.
value
# Core binding routines.
Rivets
.
binders
=
...
...
@@ -306,10 +313,16 @@ Rivets.binders =
unbind
:
(
el
)
->
unbindEvent
el
,
'change'
,
@
currentListener
routine
:
(
el
,
value
)
->
if
el
.
type
is
'select-multiple'
o
.
selected
=
o
.
value
in
value
for
o
in
el
if
value
?
else
if
value
?
.
toString
()
isnt
el
.
value
?
.
toString
()
el
.
value
=
if
value
?
then
value
else
''
if
window
.
jQuery
?
el
=
jQuery
el
if
value
?
.
toString
()
isnt
el
.
val
()
?
.
toString
()
el
.
val
if
value
?
then
value
else
''
else
if
el
.
type
is
'select-multiple'
o
.
selected
=
o
.
value
in
value
for
o
in
el
if
value
?
else
if
value
?
.
toString
()
isnt
el
.
value
?
.
toString
()
el
.
value
=
if
value
?
then
value
else
''
text
:
(
el
,
value
)
->
if
el
.
innerText
?
...
...
Please
register
or
sign in
to post a comment