c102b078 by Michael Richards

Merge branch 'multiple-select-support'

2 parents f6c70967 20c0b4b7
...@@ -240,6 +240,7 @@ unbindEvent = (el, event, fn) -> ...@@ -240,6 +240,7 @@ unbindEvent = (el, event, fn) ->
240 getInputValue = (el) -> 240 getInputValue = (el) ->
241 switch el.type 241 switch el.type
242 when 'checkbox' then el.checked 242 when 'checkbox' then el.checked
243 when 'select-multiple' then o.value for o in el when o.selected
243 else el.value 244 else el.value
244 245
245 # Returns an event binding routine for the specified event. 246 # Returns an event binding routine for the specified event.
...@@ -311,6 +312,9 @@ Rivets.routines = ...@@ -311,6 +312,9 @@ Rivets.routines =
311 html: (el, value) -> 312 html: (el, value) ->
312 el.innerHTML = if value? then value else '' 313 el.innerHTML = if value? then value else ''
313 value: (el, value) -> 314 value: (el, value) ->
315 if el.type is 'select-multiple'
316 o.selected = o.value in value for o in el if value?
317 else
314 el.value = if value? then value else '' 318 el.value = if value? then value else ''
315 text: (el, value) -> 319 text: (el, value) ->
316 if el.innerText? 320 if el.innerText?
......