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

title as function #2414

Open
ataft opened this issue Mar 23, 2020 · 1 comment
Open

title as function #2414

ataft opened this issue Mar 23, 2020 · 1 comment

Comments

@ataft
Copy link

ataft commented Mar 23, 2020

Would you accept a PR to allow the title option as a function?

The use case is to display something different for the button text and the button title, like this:
image

The logic is very simple and non-intrusive:

      if(typeof this.options.title === 'function') {
        button.title = this.options.title(selectedOptions, selectedCount, totalCount);
      } else {
        // strip all HTML tags and trim the result, then unescape any escaped tags
        button.title = titleFragment.textContent.replace(/<[^>]*>?/g, '').trim();
      }

@caseyjhol
Copy link
Member

caseyjhol commented Apr 17, 2020

Hold off on this for now. We're in the process of replacing title with a placeholder option instead ("title" will be deprecated). The title option as we now know it will be removed in v2.0.0 and be replaced with normal title attribute functionality.

Follow #2147 and #2369.

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

No branches or pull requests

2 participants