移除空的class

This commit is contained in:
2023-10-04 06:14:38 +08:00
parent 6b6dd495ce
commit a86f0c77d8
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@ export function createElement({ innerText, textContent, onclick, children = [],
for (const key in attributes) {
element.setAttribute(key, attributes[key])
}
element.classList.add(...classList)
if (classList.length) element.classList.add(...classList)
if (innerText) element.innerText = innerText
if (textContent) element.textContent = textContent
if (onclick) element.onclick = onclick