UNPKG

@ribajs/core

Version:

Core module of Riba.js

17 lines (15 loc) 414 B
import { Binder } from "../binder.js"; /** * Hides the element when value is true (negated version of `show` binder). */ export class HideBinder extends Binder<boolean, HTMLElement> { static key = "hide"; routine(el: HTMLElement, value: boolean) { el.style.display = value ? "none" : ""; if (value) { el.setAttribute("hidden", ""); } else { el.removeAttribute("hidden"); } } }