- Issue created by @roderickgadellaabsl
- last update
over 1 year ago Custom Commands Failed - Status changed to Needs review
over 1 year ago 7:57pm 24 October 2023 - last update
over 1 year ago 29,675 pass - Status changed to Needs work
over 1 year ago 8:44pm 24 October 2023 - First commit to issue fork.
- Status changed to Closed: duplicate
11 months ago 9:59pm 29 April 2024 - 🇺🇸United States jrb Raleigh-Durham Area, NC, USA
I think this is a duplicate of 🐛 active-link.js throws JS error if query string parameter contains a single quote Needs work
Per that issue, it seems that the actual problem is the
'
(single quote) in thequeryString
variable that causes this line of JavaScript (prior to what the patch here changes) to produce what will be an invalid selector:const querySelector = path.currentQuery ? `[data-drupal-link-query='${queryString}']` : ':not([data-drupal-link-query])';
In that issue, the solution is to escape the single quote. That fixes this issue as well. The use of
CSS.escape
in the patch of this issue, prevents the errors from being thrown, but I don't think it actually fixes the problem. The resulting selector still won't be valid-- it will just be escaped. I think the solution in that issue is the way to go. - 🇳🇱Netherlands roderickgadellaabsl
Hmm it's not just `queryString`, any query parameter could contain a single quote (`'`).
Since active-link pipes content through `querySelector()` that it does not control, I think it's safer to just `CSS.escape()` it all? There could be single quotes (and other characters!) in the query params that would cause active-link to fail?