@coreui/vue-pro
Version:
UI Components Library for Vue.js
23 lines (19 loc) • 669 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
const getPreviousSibling = (elem, selector) => {
// Get the next sibling element
let sibling = elem.previousElementSibling;
// If there's no selector, return the first sibling
if (!selector)
return sibling;
// If the sibling matches our selector, use it
// If not, jump to the next sibling and continue the loop
while (sibling) {
if (sibling.matches(selector))
return sibling;
sibling = sibling.previousElementSibling;
}
return;
};
exports.default = getPreviousSibling;
//# sourceMappingURL=getPreviousSibling.js.map