Merge branch 'multiple-select-support'
Showing
1 changed file
with
5 additions
and
1 deletions
... | @@ -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,7 +312,10 @@ Rivets.routines = | ... | @@ -311,7 +312,10 @@ 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) -> |
314 | el.value = if value? then value else '' | 315 | if el.type is 'select-multiple' |
316 | o.selected = o.value in value for o in el if value? | ||
317 | 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? |
317 | el.innerText = if value? then value else '' | 321 | el.innerText = if value? then value else '' | ... | ... |
-
Please register or sign in to post a comment