js: Only use ids in Utils.getCSSPath() if they're truly unique
This commit is contained in:
parent
4f501a89f5
commit
fe6be6a107
|
@ -373,8 +373,8 @@
|
||||||
while (true) {
|
while (true) {
|
||||||
var id = element.id;
|
var id = element.id;
|
||||||
|
|
||||||
// Ignore forms and form controls because id generation is unreliable :(
|
// Only use ids if they're truly unique
|
||||||
if (id && ! element.form && ! (element instanceof HTMLFormElement)) {
|
if (!! id && document.querySelectorAll('* #' + id).length === 1) {
|
||||||
path.push('#' + id);
|
path.push('#' + id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue