1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 08:07:59 +01:00

Better DOM#is(). Yay.

This commit is contained in:
Kris Maglione
2011-10-16 15:06:37 -04:00
parent 0c3bccb5c6
commit 3ef14e8c3c
2 changed files with 2 additions and 19 deletions

View File

@@ -2255,7 +2255,7 @@ var ItemList = Class("ItemList", {
let win = this.win;
let row = this.selectedRow;
if (row) {
if (row && this.parent.minHeight) {
let { rect } = DOM(this.selectedRow);
var scrollY = this.win.scrollY + rect.bottom - this.win.innerHeight;
}

View File

@@ -98,24 +98,7 @@ var DOM = Class("DOM", {
}]
]),
matcher: function matcher(sel) {
let res;
if (/^([a-z0-9_-]+)$/i.exec(sel))
res = function (elem) elem.localName == val;
else if (/^#([a-z0-9:_-]+)$/i.exec(sel))
res = function (elem) elem.id == val;
else if (/^\.([a-z0-9:_-]+)$/i.exec(sel))
res = function (elem) elem.classList.contains(val);
else if (/^\[([a-z0-9:_-]+)\]$/i.exec(sel))
res = function (elem) elem.hasAttribute(val);
else
res = function (elem) ~Array.indexOf(elem.parentNode.querySelectorAll(sel),
elem);
let val = RegExp.$1;
return res;
},
matcher: function matcher(sel) function (elem) elem.mozMatchesSelector && elem.mozMatchesSelector(sel),
each: function each(fn, self) {
let obj = self || this.Empty();