Bug 1360132 - Escaped tagName with cssEscape in findCssSelector to deal with special chars; r=pbro

MozReview-Commit-ID: CadEDXDYeBV

--HG--
extra : rebase_source : 0f993ff164156e46271c2c249d801404c0396318
This commit is contained in:
nbeltran14 2017-05-11 20:03:35 +02:00
Родитель 0cd2f844e4
Коммит 8a674f1ac1
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -87,7 +87,7 @@ const findCssSelector = function(ele) {
return selector;
}
// Maybe it's unique with a tag name?
selector = tagName + selector;
selector = cssEscape(tagName) + selector;
matches = document.querySelectorAll(selector);
if (matches.length === 1) {
return selector;
@ -107,7 +107,7 @@ const findCssSelector = function(ele) {
if (ele.parentNode !== document) {
index = positionInNodeList(ele, ele.parentNode.children) + 1;
selector = findCssSelector(ele.parentNode) + " > " +
tagName + ":nth-child(" + index + ")";
cssEscape(tagName) + ":nth-child(" + index + ")";
}
return selector;