mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 10:07:59 +01:00
Better DOM#is(). Yay.
This commit is contained in:
@@ -2255,7 +2255,7 @@ var ItemList = Class("ItemList", {
|
|||||||
|
|
||||||
let win = this.win;
|
let win = this.win;
|
||||||
let row = this.selectedRow;
|
let row = this.selectedRow;
|
||||||
if (row) {
|
if (row && this.parent.minHeight) {
|
||||||
let { rect } = DOM(this.selectedRow);
|
let { rect } = DOM(this.selectedRow);
|
||||||
var scrollY = this.win.scrollY + rect.bottom - this.win.innerHeight;
|
var scrollY = this.win.scrollY + rect.bottom - this.win.innerHeight;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,24 +98,7 @@ var DOM = Class("DOM", {
|
|||||||
}]
|
}]
|
||||||
]),
|
]),
|
||||||
|
|
||||||
matcher: function matcher(sel) {
|
matcher: function matcher(sel) function (elem) elem.mozMatchesSelector && elem.mozMatchesSelector(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;
|
|
||||||
},
|
|
||||||
|
|
||||||
each: function each(fn, self) {
|
each: function each(fn, self) {
|
||||||
let obj = self || this.Empty();
|
let obj = self || this.Empty();
|
||||||
|
|||||||
Reference in New Issue
Block a user