Skip to content

Quote in option value causes a JS error #1971

Closed as not planned
Closed as not planned
@cheack

Description

@cheack

I did:

  • Search for if my issue has already been submitted
  • Make sure I'm reporting something precise that needs to be fixed
  • Give my issue a descriptive and concise title
  • Create a minimal working example on JsFiddle or Codepen (or gave a link to a demo on the Selectize docs)
  • Indicate precise steps to reproduce in numbers and the result, like below

Steps to reproduce:

  1. Add select with an option with a quote in value (").
  2. Init a selectize.
  3. Select any option.

See https://jsfiddle.net/cheack/j59o6kna/15/

Expected result: no errors.

Actual result: Uncaught Error: Syntax error, unrecognized expression

Error trace
jquery.js:1560 Uncaught Error: Syntax error, unrecognized expression: option[value="Some text ""]
  at Sizzle.error (jquery.js:1560:8)
  at Sizzle.tokenize (jquery.js:2216:11)
  at Function.Sizzle [as find] (jquery.js:833:15)
  at jQuery.fn.init.find (jquery.js:2896:11)
  at Selectize.updateOriginalInput (selectize.min.js:30:35960)
  at Selectize.<anonymous> (selectize.min.js:30:32702)
  at debounce_events (selectize.min.js:30:8541)
  at Selectize.addItem (selectize.min.js:30:31982)
  at Selectize.onOptionSelect (selectize.min.js:30:21835)
  at HTMLDivElement.<anonymous> (selectize.min.js:30:14517)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions