dom-safe

The set of functions for safe working with dom

Usage no npm install needed!

<script type="module">
  import domSafe from 'https://cdn.skypack.dev/dom-safe';
</script>

README

Safe-Dom

The set of functions for safe working with browser DOM

How to install

    npm install safe-dom

Usage

    import dom from '/node_modules/safe-dom/main.js'

clearChilds()

Safe remove all childs from DOM node with removing all listeners

class(classObj)

convert object fields to DOM class. The keys of objects becomes classes in DOM class string depends on theirs values. The keys with false values will be no added to resulting className

    const cstr = dom.class({ one: true, two: false, three: true });
    console.log(cstr); //'one three';