viewmodel
viewmodel copied to clipboard
"disable" binding doesn't work with "select" elements
Hello! I think I have found a bug with "disable" binding:
When used with a "select" element, it just adds "disabled" to select classes. I think it should behave as a input, button or text area. I was checking the source code and the problem appears to be between the lines 255-265:
enable = (elem) ->
if elem.is('button') or elem.is('input') or elem.is('textarea')
elem.removeAttr('disabled')
else
elem.removeClass('disabled')
disable = (elem) ->
if elem.is('button') or elem.is('input') or elem.is('textarea')
elem.attr('disabled', 'disabled')
else
elem.addClass('disabled')
I think it should be this way:
enable = (elem) ->
if elem.is('button') or elem.is('input') or elem.is('textarea') or elem.is('select')
elem.removeAttr('disabled')
else
elem.removeClass('disabled')
disable = (elem) ->
if elem.is('button') or elem.is('input') or elem.is('textarea') or elem.is('select')
elem.attr('disabled', 'disabled')
else
elem.addClass('disabled')
Thanks for the library! It's very useful to me right now.