vuikit
Version:
A responsive Vue UI library for web site interfaces based on UIkit
53 lines (48 loc) • 1.49 kB
JavaScript
/**
* Vuikit 0.8.10
* (c) 2018 Miljan Aleksic
* @license MIT
**/
/* Substantial part of the code is adapted from UIkit,
Copyright (c) 2013-2018 YOOtheme GmbH, getuikit.com */
import { closest, matches } from './selector';
import { isDocument, isString, toNode, toNodes } from './lang';
var voidElements = {
area: true,
base: true,
br: true,
col: true,
embed: true,
hr: true,
img: true,
input: true,
keygen: true,
link: true,
menuitem: true,
meta: true,
param: true,
source: true,
track: true,
wbr: true
};
function isVoidElement (element) {
return toNodes(element).some(function (element) { return voidElements[element.tagName.toLowerCase()]; })
}
function isVisible (element) {
return toNodes(element).some(function (element) { return element.offsetHeight || element.getBoundingClientRect().height; })
}
var selInput = 'input,select,textarea,button';
function isInput (element) {
return toNodes(element).some(function (element) { return matches(element, selInput); })
}
function filter (element, selector) {
return toNodes(element).filter(function (element) { return matches(element, selector); })
}
function within (element, selector) {
return !isString(selector)
? element === selector || (isDocument(selector)
? selector.documentElement
: toNode(selector)).contains(toNode(element))
: matches(element, selector) || closest(element, selector)
}
export { isVoidElement, isVisible, selInput, isInput, filter, within };