Milestone with double quotes on the name `"` is never marked as selected in the dropdowns

Summary

We use the milestone name to uniquely identify a milestone, the reason for this is:

the milestone.name is used in the old issue search bar, still being used in https://gitlab.com/dashboard/issues

and we need the ID because we "needed" to specify the name, not a numeric ID, because when filtering by one milestone at the group level, that name could refer to a number of project-level milestones that we'd actually need to filter by.

when we create a milestone with a double quote within the name, we break the query we make to the DOM:https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/milestone_select.js#L138 and we never mark it as selected.

what it looks like what is should look like
Screen_Shot_2018-03-08_at_12.32.16 Screen_Shot_2018-03-08_at_12.31.45

Steps to reproduce

  1. Create a milestone called "Test"
  2. In the new issue page, select "Test" in the milestone dropdown
  3. Close the dropdown
  4. Open it again
  5. It should have a ✔ icon

What is the current bug behavior?

The selected option is not marked as selected

What is the expected correct behavior?

The selected option should be marked as selected

Note: This works properly in the labels dropdown

Assignee Loading
Time tracking Loading