diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2019-01-04 12:29:13 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2019-01-04 12:29:13 +0100 |
commit | 9bfb369f0bf05d8f104e39b6c93d95af37fd7739 (patch) | |
tree | 8e43a456964b495df0905f02cd0007602d8d744e /crocoite/data | |
parent | 9d7974e3e7e8a4575ea61cb33a30fa291d12ae38 (diff) | |
download | crocoite-9bfb369f0bf05d8f104e39b6c93d95af37fd7739.tar.gz crocoite-9bfb369f0bf05d8f104e39b6c93d95af37fd7739.tar.bz2 crocoite-9bfb369f0bf05d8f104e39b6c93d95af37fd7739.zip |
behavior: Support clicking area and add testcase
Diffstat (limited to 'crocoite/data')
-rw-r--r-- | crocoite/data/extract-links.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crocoite/data/extract-links.js b/crocoite/data/extract-links.js index 4d1a3d0..483a35f 100644 --- a/crocoite/data/extract-links.js +++ b/crocoite/data/extract-links.js @@ -25,12 +25,14 @@ function isClickable (o) { } /* --- end copy&paste */ -let x = document.body.querySelectorAll('a[href]'); let ret = []; -for (let i=0; i < x.length; i++) { - if (isClickable (x[i])) { - ret.push (x[i].href); +['a[href]', 'area[href]'].forEach (function (s) { + let x = document.body.querySelectorAll(s); + for (let i=0; i < x.length; i++) { + if (isClickable (x[i])) { + ret.push (x[i].href); + } } -} +}); return ret; /* immediately return results, for use with Runtime.evaluate() */ })(); |