Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function matches (element, selector, options) {
addPseudos(options)
return element && Sizzle.matchesSelector(element, selector)
}
, is = function (s) {
var i, l
for (i = 0, l = this.length; i < l; i++) {
if (sizzle.matchesSelector(this[i], s))
return true
}
return false
}
u.getFirstChildElement = function (el, selector='*') {
let first_el = el.firstElementChild;
while (first_el !== null && !sizzle.matchesSelector(first_el, selector)) {
first_el = first_el.nextElementSibling
}
return first_el;
}
u.getLastChildElement = function (el, selector='*') {
let last_el = el.lastElementChild;
while (last_el !== null && !sizzle.matchesSelector(last_el, selector)) {
last_el = last_el.previousElementSibling
}
return last_el;
}
u.ancestor = function (el, selector) {
let parent = el;
while (parent !== null && !sizzle.matchesSelector(parent, selector)) {
parent = parent.parentElement;
}
return parent;
}
u.getNextElement = function (el, selector='*') {
let next_el = el.nextElementSibling;
while (next_el !== null && !sizzle.matchesSelector(next_el, selector)) {
next_el = next_el.nextElementSibling;
}
return next_el;
}
u.getPreviousElement = function (el, selector='*') {
let prev_el = el.previousElementSibling;
while (prev_el !== null && !sizzle.matchesSelector(prev_el, selector)) {
prev_el = prev_el.previousElementSibling
}
return prev_el;
}