fd434ad2 by Michael Richards

Use jQuery's .val(…) in the value binder's routine function if window.jQuery is …

…present. [Closes #133]
1 parent 790f145e
...@@ -313,10 +313,16 @@ Rivets.binders = ...@@ -313,10 +313,16 @@ Rivets.binders =
313 unbind: (el) -> 313 unbind: (el) ->
314 unbindEvent el, 'change', @currentListener 314 unbindEvent el, 'change', @currentListener
315 routine: (el, value) -> 315 routine: (el, value) ->
316 if el.type is 'select-multiple' 316 if window.jQuery?
317 o.selected = o.value in value for o in el if value? 317 el = jQuery el
318 else if value?.toString() isnt el.value?.toString() 318
319 el.value = if value? then value else '' 319 if value?.toString() isnt el.val()?.toString()
320 el.val if value? then value else ''
321 else
322 if el.type is 'select-multiple'
323 o.selected = o.value in value for o in el if value?
324 else if value?.toString() isnt el.value?.toString()
325 el.value = if value? then value else ''
320 326
321 text: (el, value) -> 327 text: (el, value) ->
322 if el.innerText? 328 if el.innerText?
......