Normalize selector operation in scrollspy #41726
Open
+34
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #39198
Closes: #37858
Fix: #35566 (Hope, see below)
Description
Allows you to select the elements in the Scrollspy component that need to be escaped.
Motivation & Context
Users complain that they can't always control how their IDs for a component are filled in.
Type of changes
Checklist
npm run lint
)Live previews
Related issues
#39198
#37858
#32586
#35566 (very important)
In PR #35566, @pierresouchay added a selector search mechanism when escaping
selector = selector.replaceAll(/#([^\s"#']+)/g, (match, id) => '#' + CSS.escape(id))
. I removed the#
symbol from there, as it interfered with the current implementation, but did not affect the previous functionality (during manual and automatic testing). I do not know why it was not necessary to escape the identifier inside the expression (#firistid#secondId is invalid), but the functionality works. In the worst case, it was necessary, but they just forgot to write the tests. At best, everything is fine.P.S. A lot of questions, so I will be glad to receive feedback))