web: Add missing CSS selector escaping.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-09-08 14:11:56 -07:00
committed by Tim Abbott
parent b4f02a336d
commit 61bc10ca01
6 changed files with 16 additions and 6 deletions

View File

@@ -8,7 +8,12 @@ exports.mock_banners = () => {
// zjquery doesn't support `remove`, which is used when clearing the compose box.
// TODO: improve how we test this so that we don't have to mock things like this.
for (const classname of Object.values(compose_banner.CLASSNAMES)) {
$(`#compose_banners .${classname.replaceAll(" ", ".")}`).remove = () => {};
$(
`#compose_banners .${classname
.split(" ")
.map((classname) => CSS.escape(classname))
.join(".")}`,
).remove = () => {};
}
$("#compose_banners .warning").remove = () => {};
$("#compose_banners .error").remove = () => {};