Hellama - Autoremoving elements

Back to Hellama

There is a special data-if attribute, which is removed in every case. It also takes with it the owner element if it is not properly replaced (i.e. it contains opening hellama sequence after the processing). This happens when the replacement is missing or equals null (other falsy values don't kill the element).

<span class="test" data-if="{one}">1</span> <span class="test" data-if="{two}">2</span> <span class="test" data-if="{three}">3</span> const cfg = { open: "{", close: "}" }; const tags = { one: "", three: 1 }; // "two: null" also works hellama(document.getElementsByClassName("test"), tags, cfg);