Skip to content

Commit

Permalink
fix(esl-utils): fix usage of deprecated substr in CSSClassUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
ala-n committed Dec 3, 2021
1 parent 594b889 commit c142152
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/esl-utils/dom/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const lock = (el: Element, className: string, locker: Element) => {
};
/**
* Manage className unlock for the element
* @returns true if className have no lockes
* @returns true if className have no locks
*/
const unlock = (el: Element, className: string, locker: Element) => {
const elLocks = lockStore.get(el);
Expand All @@ -31,7 +31,7 @@ const unlock = (el: Element, className: string, locker: Element) => {
* Supports inversion and locker management.
*/
const add = (el: Element, className: string, locker?: Element): void => {
if (className[0] === '!') return CSSClassUtils.remove(el, className.substr(1), locker);
if (className[0] === '!') return CSSClassUtils.remove(el, className.substring(1), locker);
if (locker) lock(el, className, locker);
el.classList.add(className);
};
Expand All @@ -41,7 +41,7 @@ const add = (el: Element, className: string, locker?: Element): void => {
* Supports inversion and locker management.
*/
const remove = (el: Element, className: string, locker?: Element): void => {
if (className[0] === '!') return CSSClassUtils.add(el, className.substr(1), locker);
if (className[0] === '!') return CSSClassUtils.add(el, className.substring(1), locker);
if (locker && !unlock(el, className, locker)) return;
if (!locker) CSSClassUtils.unlock(el, className);
el.classList.remove(className);
Expand Down

0 comments on commit c142152

Please sign in to comment.