Whitespace

This commit is contained in:
Bryan Helmkamp 2009-09-17 20:15:40 -04:00
parent e7a3ac865c
commit aae82b5111
1 changed files with 12 additions and 4 deletions

View File

@ -1,12 +1,20 @@
var links = inDocument.getElementsByTagName('a');
var candidateLinks = $A(links).select(function(candidateLink) {
var textMatched = PatternMatcher.matches(locator, getText(candidateLink));
var idMatched = PatternMatcher.matches(locator, candidateLink.id);
var titleMatched = PatternMatcher.matches(locator, candidateLink.title);
return textMatched || idMatched || titleMatched;
});
if (candidateLinks.length == 0) {
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();