Use jQuery's .val() in getInputValue if window.jQuery is present. [#133]
Showing
1 changed file
with
12 additions
and
5 deletions
... | @@ -251,12 +251,19 @@ unbindEvent = (el, event, fn) -> | ... | @@ -251,12 +251,19 @@ unbindEvent = (el, event, fn) -> |
251 | event = 'on' + event | 251 | event = 'on' + event |
252 | el.detachEvent event, fn | 252 | el.detachEvent event, fn |
253 | 253 | ||
254 | # Returns the current input value for the specified element. | 254 | # Cross-browser input value getter. |
255 | getInputValue = (el) -> | 255 | getInputValue = (el) -> |
256 | switch el.type | 256 | if window.jQuery? |
257 | when 'checkbox' then el.checked | 257 | el = jQuery el |
258 | when 'select-multiple' then o.value for o in el when o.selected | 258 | |
259 | else el.value | 259 | switch el[0].type |
260 | when 'checkbox' then el.is ':checked' | ||
261 | else el.val() | ||
262 | else | ||
263 | switch el.type | ||
264 | when 'checkbox' then el.checked | ||
265 | when 'select-multiple' then o.value for o in el when o.selected | ||
266 | else el.value | ||
260 | 267 | ||
261 | # Core binding routines. | 268 | # Core binding routines. |
262 | Rivets.binders = | 269 | Rivets.binders = | ... | ... |
-
Please register or sign in to post a comment