I've been developing a library with a strict size limit of 1KB, and I'm almost hitting that threshold. My challenge now is to implement a CSS rule for controlling the show/hide behavior.
[hidden]{ display:none !important }
The HTML page does not contain any style tags, so this single rule is all I need. However, I can only add it using pure JavaScript. I prefer not to change an element's style directly with el.style.display = 'none', but instead want to manipulate it through an attribute.
Has anyone discovered a more efficient approach than creating a style element, setting its innerHTML, and appending it to the head element? I'd love to hear a clever solution that minimizes character usage.