match against buttons values
authorSylvester Johansson <scj@archlinux.us>
Mon, 1 Jun 2009 17:29:53 +0000 (19:29 +0200)
committerSylvester Johansson <scj@archlinux.us>
Mon, 1 Jun 2009 17:29:53 +0000 (19:29 +0200)
examples/scripts/linkfollow.js

index b90b82d..3b40f37 100644 (file)
@@ -94,9 +94,17 @@ function Hints(){
     this.test = test;
     this.toString = toString;
     this.numbers = numbers;
+    function matchAgainst(element){
+      if(element.node.nodeName == "INPUT"){
+        return element.node.title;
+      } else {
+        return element.node.textContent;
+      }
+    }
     function test(element) {
       // test all the regexp
-      return words.every(function (regex) { return element.node.textContent.match(regex)});
+      var item = matchAgainst(element);
+      return words.every(function (regex) { return item.match(regex)});
     }
   }