ehynds / jquery-ui-multiselect-widget

jQuery UI MultiSelect widget

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Html tags in options

zgorbe opened this issue · comments

What is the current behavior?

When an option item is created for the menu the text() function is used to "copy" the option's text into the result span (around line 212).

What is the expected behavior?

Would it make sense to use the html() function instead of text() function to support tags like bold, italic etc. for basic styling in the menu option items?

If you are requesting a new or changed feature, please provide a rationale

It would be great to have support for an option label like: "First option with some bold text".

Will you submit a corresponding Pull Request to fix the bug or implement the feature?

Please tell us about your setup

  • Version: 2.0.1
  • Browser: N/A
  • Other frameworks in use:

This behavior was initially introduced a long time ago to prevent JavaScript injection into options as the widget rendered.

I guess I'm going to close this for now. In version 3 we decided to put the onus on the consuming developer to prevent injection: https://github.com/ehynds/jquery-ui-multiselect-widget/blob/version3/src/jquery.multiselect.js#L460

You can add html to options in version 3 by adding the html to the option tag.