зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1635970 - Extended support for XPath expressions in Inspector search. r=jdescottes
The limitation to expressions starting with a slash was lifted in order to allow searching via other possible XPath expressions like `id("foo")` or `(//div)[2]`. Differential Revision: https://phabricator.services.mozilla.com/D80963
This commit is contained in:
Родитель
e4bc88f3e9
Коммит
63db1cbfbc
|
@ -210,8 +210,7 @@ WalkerSearch.prototype = {
|
|||
},
|
||||
|
||||
_searchXPath: function(query, options, results) {
|
||||
const isXPath = query && query.startsWith("/");
|
||||
if (!options.types.includes("xpath") || !isXPath) {
|
||||
if (!options.types.includes("xpath")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -183,6 +183,18 @@ add_task(async function() {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
desc: "Search using XPath grouping expression",
|
||||
search: "(//*)[2]",
|
||||
expected: [{ node: inspectee.querySelector("head"), type: "xpath" }],
|
||||
},
|
||||
{
|
||||
desc: "Search using XPath function",
|
||||
search: "id('arrows')",
|
||||
expected: [
|
||||
{ node: inspectee.querySelector("#arrows"), type: "xpath" },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const isDeeply = (a, b, msg) => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче