UNPKG

jcore-ui

Version:

jcore-ui - components for building an interface

49 lines 1.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const element = { coord(element) { return { height: element.getBoundingClientRect().bottom - element.getBoundingClientRect().top, width: element.getBoundingClientRect().right - element.getBoundingClientRect().left, scrollHeight: element.scrollHeight, top: element.getBoundingClientRect().top, bottom: element.getBoundingClientRect().bottom, left: element.getBoundingClientRect().left, right: element.getBoundingClientRect().right, clientHeight: document.documentElement.clientHeight, clientWidth: document.documentElement.clientWidth, }; }, // create(tag: string, attributes: IObject, children: Array<Element>, text: string, ns:string = null) { // attributes = attributes || null; // children = children || null; // text = text || null; // let element: Element; // if (ns) { // element = document.createElementNS(ns, tag); // } else { // element = document.createElement(tag); // } // if (children !== null) { // children.forEach = [].forEach; // children.forEach(child => { // if (child !== null) { // element.appendChild(child); // } // }); // } // if (attributes !== null) { // for (let key in attributes) { // if (key !== '') { // element.setAttribute(key, attributes[key]) // } // } // } // if (text) { // element.innerHTML = text; // } // return element; // }, }; exports.default = element; //# sourceMappingURL=element.js.map