utils.js: Use jQuery to check id uniqueness

This commit is contained in:
Johannes Meyer 2022-02-24 16:38:10 +01:00
parent 52d51f0ee5
commit 762663a3f6
1 changed files with 4 additions and 1 deletions

View File

@ -374,7 +374,10 @@
var id = element.id;
// Only use ids if they're truly unique
if (!! id && document.querySelectorAll('* #' + id).length === 1) {
// TODO: The check used to use document.querySelectorAll, but this resulted in many issues with ids
// that start with a decimal. jQuery seems to escape those correctly, so this is the only reason
// why it's still.. jQuery.
if (!! id && $('* #' + id).length === 1) {
path.push('#' + id);
break;
}