@acanto/core-dom
Advanced tools
Comparing version 0.0.16 to 0.0.17
32
index.ts
@@ -112,2 +112,34 @@ /** | ||
/** | ||
* Add class shortcut | ||
*/ | ||
export function addClass<T extends Element = HTMLElement>( | ||
el?: T, | ||
className?: string | ||
) { | ||
if (__DEV__) { | ||
if (!el) { | ||
console.error("Used `addClass` with an unexisting DOM element"); | ||
return; | ||
} | ||
} | ||
if (el) el.classList.add(className); | ||
} | ||
/** | ||
* Remove class shortcut | ||
*/ | ||
export function removeClass<T extends Element = HTMLElement>( | ||
el?: T, | ||
className?: string | ||
) { | ||
if (__DEV__) { | ||
if (!el) { | ||
console.error("Used `removeClass` with an unexisting DOM element"); | ||
return; | ||
} | ||
} | ||
if (el) el.classList.remove(className); | ||
} | ||
/** | ||
* Set vendor CSS rule | ||
@@ -114,0 +146,0 @@ * |
{ | ||
"name": "@acanto/core-dom", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"author": "Acanto <info@acanto.net> (https://acanto.agency/)", | ||
@@ -18,3 +18,3 @@ "license": "ISC", | ||
"sideEffects": false, | ||
"gitHead": "d72bfa57c6debe42b34eb6eb81f22d0021297eaf" | ||
"gitHead": "f31e5fb27fe94c35b5543531363ae25aa437b718" | ||
} |
24348
805