Skip to content

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

@eriverosr

Description

@eriverosr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions