tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
33 lines (23 loc) β’ 1.16 kB
Markdown
### β¨ Whatβs New
* **TinyHtml now supports `classCanWhitespace`** π
You can now configure whether class names with whitespace are allowed or not!
* `TinyHtml.classCanWhitespace = true` β β
enables whitespace in class names
* `TinyHtml.classCanWhitespace = false` β π« disallows whitespace in class names
* Any non-boolean value will throw a **TypeError** for extra safety π
### π Why it matters
This gives you **more control and consistency** when working with DOM elements, ensuring that your projects can enforce stricter or looser rules depending on your coding style.
### π Example
```js
// Enable whitespace in class names
TinyHtml.classCanWhitespace = true;
elem.addClass('pudding mio');
console.log(TinyHtml.classCanWhitespace); // true
// Disable whitespace in class names
TinyHtml.classCanWhitespace = false;
elem.addClass('pudding');
console.log(TinyHtml.classCanWhitespace); // false
// β Throws error
TinyHtml.classCanWhitespace = "yes";
// -> Uncaught TypeError: classCanWhitespace must be a boolean
```
**Full Changelog**: https://github.com/JasminDreasond/Tiny-Essentials/compare/1.23.1...1.23.2