Skip to content

Commit

Permalink
fix(settings): remove unused class settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Sisha0 committed Apr 17, 2021
1 parent 173a664 commit bb208c1
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions src/settings/settings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {UIPBoolSetting} from './setting/bool-setting/bool-setting';
import {UIPSelectSetting} from './setting/select-setting/select-setting';
import {UIPTextSetting} from './setting/text-setting/text-setting';
import {UIPClassSetting} from './setting/class-setting/class-setting';
import {UIPSetting} from './setting/setting';
import {bind} from '@exadel/esl/modules/esl-utils/decorators/bind';
import {ESLBaseElement, attr} from '@exadel/esl/modules/esl-base-element/core';
Expand Down Expand Up @@ -83,10 +82,6 @@ export class UIPSettings extends ESLBaseElement {
];
}

protected get classSettingsTags(): any[] {
return [...this.getElementsByTagName(UIPClassSetting.is)];
}

@bind
public parseCode(e: CustomEvent): void {
const {markup, source} = e.detail;
Expand All @@ -99,8 +94,6 @@ export class UIPSettings extends ESLBaseElement {
const component = new DOMParser().parseFromString(markup, 'text/html').body;

this.setAttrSettings(component);
this.setClassSettings(component);

}

protected renderWrapper(markup: string) {
Expand Down Expand Up @@ -134,25 +127,5 @@ export class UIPSettings extends ESLBaseElement {
}
}
}

protected setClassSettings(component: HTMLElement): void {
for (let classSetting of this.classSettingsTags) {
classSetting = classSetting as UIPClassSetting;
const {selector, values} = classSetting;

const classLists: DOMTokenList[] = Array.prototype.map.call(component.querySelectorAll(selector),
(tag: HTMLElement) => tag.classList);
if (!classLists.length) continue;

const item = values.find((val: string) => classLists[0].contains(val));

if (classLists.length === 1) {
item ? (classSetting.value = item) : (classSetting.value = 'null');
} else {
classLists.every((classList: DOMTokenList) => classList.contains(item)) ?
classSetting.value = item : classSetting.value = 'null';
}
}
}
}

0 comments on commit bb208c1

Please sign in to comment.