Whitespace
This commit is contained in:
parent
e7a3ac865c
commit
aae82b5111
|
@ -1,12 +1,20 @@
|
||||||
var links = inDocument.getElementsByTagName('a');
|
var links = inDocument.getElementsByTagName('a');
|
||||||
|
|
||||||
var candidateLinks = $A(links).select(function(candidateLink) {
|
var candidateLinks = $A(links).select(function(candidateLink) {
|
||||||
var textMatched = PatternMatcher.matches(locator, getText(candidateLink));
|
var textMatched = PatternMatcher.matches(locator, getText(candidateLink));
|
||||||
var idMatched = PatternMatcher.matches(locator, candidateLink.id);
|
var idMatched = PatternMatcher.matches(locator, candidateLink.id);
|
||||||
var titleMatched = PatternMatcher.matches(locator, candidateLink.title);
|
var titleMatched = PatternMatcher.matches(locator, candidateLink.title);
|
||||||
|
|
||||||
return textMatched || idMatched || titleMatched;
|
return textMatched || idMatched || titleMatched;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (candidateLinks.length == 0) {
|
if (candidateLinks.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
candidateLinks = candidateLinks.sortBy(function(s) { return s.length * -1; }); //reverse length sort
|
|
||||||
|
//reverse length sort
|
||||||
|
candidateLinks = candidateLinks.sortBy(function(s) {
|
||||||
|
return s.length * -1;
|
||||||
|
});
|
||||||
|
|
||||||
return candidateLinks.first();
|
return candidateLinks.first();
|
||||||
|
|
Loading…
Reference in New Issue