@wildpeaks/snapshot-dom
Version:
Converts a DOM element to a JSON tree
1 lines • 332 B
JavaScript
;function removeEmptyAttributes(t){if("object"==typeof t&&null!==t&&(Array.isArray(t.childNodes)&&t.childNodes.forEach(removeEmptyAttributes),t.attributes)){const e=[];for(const r in t.attributes)t.attributes[r]||e.push(r);e.forEach(e=>delete t.attributes[e])}}module.exports.removeEmptyAttributes=removeEmptyAttributes;