mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 22:25:30 +00:00
Bug 537290 - Reduce uses of aNode.localName, namespaceURI in XPath generation [r=zeniko]
--HG-- extra : rebase_source : 7a3717de49f34007cc1a1d5405a98c2359120450
This commit is contained in:
parent
1baff8a67f
commit
946fe7336d
@ -3010,8 +3010,12 @@ let XPathHelper = {
|
||||
if (!aNode.parentNode)
|
||||
return "";
|
||||
|
||||
let prefix = this.namespacePrefixes[aNode.namespaceURI] || null;
|
||||
let tag = (prefix ? prefix + ":" : "") + this.escapeName(aNode.localName);
|
||||
// Access localName, namespaceURI just once per node since it's expensive.
|
||||
let nNamespaceURI = aNode.namespaceURI;
|
||||
let nLocalName = aNode.localName;
|
||||
|
||||
let prefix = this.namespacePrefixes[nNamespaceURI] || null;
|
||||
let tag = (prefix ? prefix + ":" : "") + this.escapeName(nLocalName);
|
||||
|
||||
// stop once we've found a tag with an ID
|
||||
if (aNode.id)
|
||||
@ -3022,7 +3026,7 @@ let XPathHelper = {
|
||||
let count = 0;
|
||||
let nName = aNode.name || null;
|
||||
for (let n = aNode; (n = n.previousSibling); )
|
||||
if (n.localName == aNode.localName && n.namespaceURI == aNode.namespaceURI &&
|
||||
if (n.localName == nLocalName && n.namespaceURI == nNamespaceURI &&
|
||||
(!nName || n.name == nName))
|
||||
count++;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user