1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-07 02:04:11 +01:00

Fix sanitizer.

--HG--
branch : testing
This commit is contained in:
Kris Maglione
2010-05-14 14:37:56 -04:00
parent 847dc6428d
commit 34574f43bb
4 changed files with 17 additions and 2 deletions

View File

@@ -673,6 +673,20 @@ const Util = Module("util", {
return str;
},
/**
* Scrolls an element into view if and only if it's not already
* fully visible.
*
* @param {Node} elem The element to make visible.
*/
scrollIntoView: function scrollIntoView(elem) {
let win = elem.ownerDocument.defaultView;
let rect = elem.getBoundingClientRect();
if (!(rect && rect.top < win.innerHeight && rect.bottom >= 0 && rect.left < win.innerWidth && rect.right >= 0))
elem.scrollIntoView();
},
/**
* Returns an array of URLs parsed from <b>str</b>.
*