Array.from() to spread syntax

This commit is contained in:
djmaze 2020-09-22 10:13:32 +02:00
parent 07b002a66a
commit df1d0fc8d6
6 changed files with 27 additions and 7 deletions

View file

@ -58,7 +58,7 @@ const doc = document,
tpl.querySelectorAll(':not('+allowedElements+',signature)').forEach(el => el.replaceWith(getFragmentOfChildren(el)));
tpl.querySelectorAll('*').forEach(el => {
if (el.hasAttributes()) {
Array.from(el.attributes).forEach(attr => {
[...el.attributes].forEach(attr => {
let name = attr.name.toLowerCase();
if (!allowedAttributes.includes(name)) {
el.removeAttribute(name);