mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 14:27:58 +01:00
Better DOM#is(). Yay.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user