From decccdeaa91fe74783ebbb852429730ce262eb72 Mon Sep 17 00:00:00 2001 From: Charuru Date: Sat, 1 Jun 2019 22:09:59 -0400 Subject: [PATCH] Allow space separated multiple custom classnames --- src/modules/init/content.ts | 3 ++- src/modules/init/modal.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/init/content.ts b/src/modules/init/content.ts index 04d143f1..bf5f2dd8 100644 --- a/src/modules/init/content.ts +++ b/src/modules/init/content.ts @@ -44,7 +44,8 @@ const initPredefinedContent = (content: Node, elName: string, attrs: any): void const el: HTMLElement = document.createElement(elName); const elClass = `${CONTENT}__${elName}`; - el.classList.add(elClass); + const list = elClass.split(' '); + el.classList.add(...list); // Set things like "placeholder": for (let key in attrs) { diff --git a/src/modules/init/modal.ts b/src/modules/init/modal.ts index a7f7edb7..64e1ca86 100644 --- a/src/modules/init/modal.ts +++ b/src/modules/init/modal.ts @@ -38,7 +38,8 @@ const customizeModalElement = (modal: Element, opts: SwalOptions): void => { const { className } = opts; if (className) { - modal.classList.add(className); + const list = className.split(' '); + modal.classList.add(...list); } };