Skip to content

serious bug in clickListener (shown.bs.select) #1268

@ARS81

Description

@ARS81

A "shown.bs.select" event listener is attached INSIDE the button's click handler, so this gets attached again and again, every time the button is clicked.

https://github.com/silviomoreto/bootstrap-select/blob/56e4f886dc909de82db9327329c2bf0711c7df93/js/bootstrap-select.js#L1062

Debug:

      this.$button.on('click', function () {
        that.setSize();
        that.$element.on('shown.bs.select', function () {
          console.log('XXX');

Now start clicking the button several times to open and close the menu and watch the console how many time XXX is printed.

Watching the code I see the event is only removed when the select is required and in invalid state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions