Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"disable" binding doesn't work with "select" elements #260

Open
eriverosr opened this issue Jun 21, 2016 · 0 comments
Open

"disable" binding doesn't work with "select" elements #260

eriverosr opened this issue Jun 21, 2016 · 0 comments

Comments

@eriverosr
Copy link

eriverosr commented Jun 21, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant