Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

New-lines in options cause formatting issues with title attribute (if multiple options selected). #11

Closed
PhilPJL opened this issue Mar 2, 2018 · 6 comments
Labels

Comments

@PhilPJL
Copy link

PhilPJL commented Mar 2, 2018

New-lines in options cause formatting issues.

Windows 10
IE 11 / Edge
VS 2017
Bootstrap 3.3.7
Bootstrap-select 1.12.4

https://plnkr.co/edit/nBiCB4xZAP8Be4wzpj9A?p=preview

image

You might say "don't put new lines in", but sometimes this happens during VS/Resharper auto formatting.

@caseyjhol
Copy link
Member

I can't seem to recreate this in your linked example in Chrome, Edge, or IE11 on Windows 10. It almost looks like CSS or some JS isn't being loaded (as it doesn't make sense that none of the other options would be visible; even the "Close" button is missing).

@PhilPJL
Copy link
Author

PhilPJL commented Mar 6, 2018

You need to select Apple and Banana. This is on IE Edge although it's the same on any browser.
What you're seeing there is the tooltip. There's also a space before the comma in the control itself.
It's only an issue with multiple selection.
image
What we should see is
image

@caseyjhol caseyjhol changed the title New-lines in options cause formatting issues. New-lines in options cause formatting issues with title attribute. Mar 6, 2018
@caseyjhol
Copy link
Member

Ah - thanks for the clarification. Should be an easy fix.

@caseyjhol caseyjhol changed the title New-lines in options cause formatting issues with title attribute. New-lines in options cause formatting issues with title attribute (if multiple options selected). Mar 6, 2018
@PhilPJL
Copy link
Author

PhilPJL commented Mar 6, 2018

Yes, I think something like this may do it (adding .trim()):

      if (typeof $this.attr('title') !== 'undefined') {
        return $this.attr('title');
      } else if ($this.data('content') && that.options.showContent) {
        return $this.data('content').toString();
      } else {
        return icon + $this.html()**.trim()** + subtext;
      }
    }
  }).toArray();

@caseyjhol
Copy link
Member

Released in v1.13.0!

@ghost
Copy link

ghost commented Aug 26, 2018

This issue was moved by caseyjhol to snapappointments/bootstrap-select#2063.

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

No branches or pull requests

2 participants