Skip to content

Commit 6b802fc

Browse files
Escape querySelector option value
This to correctly find values like "["test"]".
1 parent 314ca71 commit 6b802fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Autocomplete/assets/src/controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export default class extends Controller {
192192
for (const [, tomSelectOption] of Object.entries(this.tomSelect.options)) {
193193
if (tomSelectOption.$order === optionOrder) {
194194
orderedOption = parentElement.querySelector(
195-
`:scope > option[value="${tomSelectOption[this.tomSelect.settings.valueField]}"]`
195+
`:scope > option[value="${tomSelectOption[this.tomSelect.settings.valueField].replace(/["\\]/g, '\\$&')}"]`
196196
);
197197

198198
break;

0 commit comments

Comments
 (0)