This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/es5/services/goto/util.js

52 lines
1.3 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getOffset = getOffset;
exports.getContainer = getContainer;
// Return target's cumulative offset from the top
function getOffset(target) {
if (typeof target === 'number') {
return target;
}
var el = $(target);
if (!el) {
throw typeof target === 'string' ? new Error("Target element \"".concat(target, "\" not found.")) : new TypeError("Target must be a Number/Selector/HTMLElement/VueComponent, received ".concat(type(target), " instead."));
}
var totalOffset = 0;
while (el) {
totalOffset += el.offsetTop;
el = el.offsetParent;
}
return totalOffset;
}
function getContainer(container) {
var el = $(container);
if (el) return el;
throw typeof container === 'string' ? new Error("Container element \"".concat(container, "\" not found.")) : new TypeError("Container must be a Selector/HTMLElement/VueComponent, received ".concat(type(container), " instead."));
}
function type(el) {
return el == null ? el : el.constructor.name;
}
function $(el) {
if (typeof el === 'string') {
return document.querySelector(el);
} else if (el && el._isVue) {
return el.$el;
} else if (el instanceof HTMLElement) {
return el;
} else {
return null;
}
}
//# sourceMappingURL=util.js.map