DOM helper functions

Stored in coffeekraken-sugar/js/dom/...

Sugar provide some cool helper function to handle the DOM. The goal of these functions is not to add another layer on top of native DOM methods like document.querySelector, but to gives you more features that does not exist like:


To use these functions, simply import them from into your codebase like this:

import closest from 'coffeekraken-sugar/js/dom/closest';
// then use it
const closestElm = closest(myHTMLElement, '.cool-selector');