Skip to content

Commit c330c1d

Browse files
Bartheyrman22Kocal
authored andcommitted
[Autocomplete] Escape querySelector dynamic selector with CSS.escape()
1 parent e9403a6 commit c330c1d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/Autocomplete/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.25.0
4+
5+
- Escape `querySelector` dynamic selector with `CSS.escape()` #2663
6+
37
## 2.23.0
48

59
- Deprecate `ExtraLazyChoiceLoader` in favor of `Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader`

src/Autocomplete/assets/dist/controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ _default_1_instances = new WeakSet(), _default_1_getCommonConfig = function _def
270270
let orderedOption = null;
271271
for (const [, tomSelectOption] of Object.entries(this.tomSelect.options)) {
272272
if (tomSelectOption.$order === optionOrder) {
273-
orderedOption = parentElement.querySelector(`:scope > option[value="${tomSelectOption[this.tomSelect.settings.valueField]}"]`);
273+
orderedOption = parentElement.querySelector(`:scope > option[value="${CSS.escape(tomSelectOption[this.tomSelect.settings.valueField])}"]`);
274274
break;
275275
}
276276
}

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="${CSS.escape(tomSelectOption[this.tomSelect.settings.valueField])}"]`
196196
);
197197

198198
break;

0 commit comments

Comments
 (0)