make label location strategy work with unescaped strings

This commit is contained in:
Thomas Jack 2009-06-02 18:31:33 -05:00
parent 2ae14f78b1
commit 4daf037146

View File

@ -1,8 +1,7 @@
var allLabels = inDocument.getElementsByTagName("label"); var allLabels = inDocument.getElementsByTagName("label");
var candidateLabels = $A(allLabels).select(function(candidateLabel){ var candidateLabels = $A(allLabels).select(function(candidateLabel){
var regExp = new RegExp('^' + locator + '\\b', 'i');
var labelText = getText(candidateLabel).strip(); var labelText = getText(candidateLabel).strip();
return (labelText.search(regExp) >= 0); return labelText.toLowerCase() == locator.toLowerCase();
}); });
if (candidateLabels.length == 0) { if (candidateLabels.length == 0) {
return null; return null;