diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-02-21 16:22:30 -0500 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-02-21 16:22:30 -0500 |
commit | 234f50bce8f529aecbc37d61ecf191c7bbd32fd6 (patch) | |
tree | 4d9c3ce24d8b45997d97f642f993413f11cafa35 /common/content/help.js | |
parent | d62c93aef02b50cdd49915f1cabc8a5cdc98c728 (diff) | |
download | pentadactyl-234f50bce8f529aecbc37d61ecf191c7bbd32fd6.tar.gz |
Add tests for dead help links. Fix some minor bugs. Show error when trying to modify a builtin group rather than failing silently.
Diffstat (limited to 'common/content/help.js')
-rw-r--r-- | common/content/help.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/common/content/help.js b/common/content/help.js index 207c7807..9faf7a2a 100644 --- a/common/content/help.js +++ b/common/content/help.js @@ -6,14 +6,18 @@ function checkFragment() { document.title = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "title")[0].textContent; - var frag = document.location.hash.substr(1); - var elem = document.getElementById(frag); + function action() { content.scrollTo(0, content.scrollY + elem.getBoundingClientRect().top - 10); // 10px context } - if (elem) { - action(); - setTimeout(action, 10); + + var frag = document.location.hash.substr(1); + if (frag) { + var elem = document.getElementById(frag); + if (elem) { + action(); + setTimeout(action, 10); + } } } |