js: Escape strings interpolated into CSS selectors with CSS.escape.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-02-03 14:23:32 -08:00
parent 9fc1adce60
commit aa650a4c88
75 changed files with 309 additions and 246 deletions

View File

@@ -209,8 +209,8 @@ function delete_choice_row(e) {
function get_profile_field_info(id) {
const info = {};
info.row = $("tr.profile-field-row[data-profile-field-id='" + id + "']");
info.form = $("tr.profile-field-form[data-profile-field-id='" + id + "']");
info.row = $(`tr.profile-field-row[data-profile-field-id='${CSS.escape(id)}']`);
info.form = $(`tr.profile-field-form[data-profile-field-id='${CSS.escape(id)}']`);
return info;
}