function TetherClass(options) { var _this = this; _classCallCheck(this, TetherClass); _get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this); this.position = this.position.bind(this); tethers.push(this); this.history = []; this.setOptions(options, false); TetherBase.modules.forEach(function (module) { if (typeof module.initialize !== 'undefined') { module.initialize.call(_this); } }); this.position(); }
n/a
function position() { tethers.forEach(function (tether) { tether.position(false); }); flush(); }
...
}
})();
const tethers = [];
const position = () => {
tethers.forEach(tether => {
tether.position(false);
});
flush();
};
function now() {
if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
return performance.now();
...
function Evented() { _classCallCheck(this, Evented); }
n/a
function addClass(el, name) { if (typeof el.classList !== 'undefined') { name.split(' ').forEach(function (cls) { if (cls.trim()) { el.classList.add(cls); } }); } else { removeClass(el, name); var cls = getClassName(el) + (' ' + name); setClassName(el, cls); } }
n/a
function defer(fn) { deferred.push(fn); }
n/a
function extend() { var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var args = []; Array.prototype.push.apply(args, arguments); args.slice(1).forEach(function (obj) { if (obj) { for (var key in obj) { if (({}).hasOwnProperty.call(obj, key)) { out[key] = obj[key]; } } } }); return out; }
n/a
function flush() { var fn = undefined; while (fn = deferred.pop()) { fn(); } }
n/a
function getActualBoundingClientRect(node) { var boundingRect = node.getBoundingClientRect(); // The original object returned by getBoundingClientRect is immutable, so we clone it // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9 var rect = {}; for (var k in boundingRect) { rect[k] = boundingRect[k]; } if (node.ownerDocument !== document) { var _frameElement = node.ownerDocument.defaultView.frameElement; if (_frameElement) { var frameRect = getActualBoundingClientRect(_frameElement); rect.top += frameRect.top; rect.bottom += frameRect.top; rect.left += frameRect.left; rect.right += frameRect.left; } } return rect; }
n/a
function getBounds(el) { var doc = undefined; if (el === document) { doc = document; el = document.documentElement; } else { doc = el.ownerDocument; } var docEl = doc.documentElement; var box = getActualBoundingClientRect(el); var origin = getOrigin(); box.top -= origin.top; box.left -= origin.left; if (typeof box.width === 'undefined') { box.width = document.body.scrollWidth - box.left - box.right; } if (typeof box.height === 'undefined') { box.height = document.body.scrollHeight - box.top - box.bottom; } box.top = box.top - docEl.clientTop; box.left = box.left - docEl.clientLeft; box.right = doc.body.clientWidth - box.width - box.left; box.bottom = doc.body.clientHeight - box.height - box.top; return box; }
n/a
function getOffsetParent(el) { return el.offsetParent || document.documentElement; }
n/a
function getScrollBarSize() { if (_scrollBarSize) { return _scrollBarSize; } var inner = document.createElement('div'); inner.style.width = '100%'; inner.style.height = '200px'; var outer = document.createElement('div'); extend(outer.style, { position: 'absolute', top: 0, left: 0, pointerEvents: 'none', visibility: 'hidden', width: '200px', height: '150px', overflow: 'hidden' }); outer.appendChild(inner); document.body.appendChild(outer); var widthContained = inner.offsetWidth; outer.style.overflow = 'scroll'; var widthScroll = inner.offsetWidth; if (widthContained === widthScroll) { widthScroll = outer.clientWidth; } document.body.removeChild(outer); var width = widthContained - widthScroll; _scrollBarSize = { width: width, height: width }; return _scrollBarSize; }
n/a
function getScrollParents(el) { // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null; // https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = getComputedStyle(el) || {}; var position = computedStyle.position; var parents = []; if (position === 'fixed') { return [el]; } var parent = el; while ((parent = parent.parentNode) && parent && parent.nodeType === 1) { var style = undefined; try { style = getComputedStyle(parent); } catch (err) {} if (typeof style === 'undefined' || style === null) { parents.push(parent); return parents; } var _style = style; var overflow = _style.overflow; var overflowX = _style.overflowX; var overflowY = _style.overflowY; if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) { if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) { parents.push(parent); } } } parents.push(el.ownerDocument.body); // If the node is within a frame, account for the parent window scroll if (el.ownerDocument !== document) { parents.push(el.ownerDocument.defaultView); } return parents; }
n/a
function hasClass(el, name) { if (typeof el.classList !== 'undefined') { return el.classList.contains(name); } var className = getClassName(el); return new RegExp('(^| )' + name + '( |$)', 'gi').test(className); }
n/a
function removeClass(el, name) { if (typeof el.classList !== 'undefined') { name.split(' ').forEach(function (cls) { if (cls.trim()) { el.classList.remove(cls); } }); } else { var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi'); var className = getClassName(el).replace(regex, ' '); setClassName(el, className); } }
n/a
function removeUtilElements() { if (zeroElement) { document.body.removeChild(zeroElement); } zeroElement = null; }
n/a
uniqueId = function () { return ++id; }
n/a
function updateClasses(el, add, all) { // Of the set of 'all' classes, we need the 'add' classes, and only the // 'add' classes to be set. all.forEach(function (cls) { if (add.indexOf(cls) === -1 && hasClass(el, cls)) { removeClass(el, cls); } }); add.forEach(function (cls) { if (!hasClass(el, cls)) { addClass(el, cls); } }); }
n/a