I want to put all attributes in a Html element into an array: like i have a jQuery Object, whichs html looks like this:
Much more concise ways to do it:
var element = document.querySelector(/* … */);
[].slice.call(element.attributes).map(function (attr) { return attr.nodeName; });
[...document.querySelector(/* … */).attributes].map(attr => attr.nodeName);
console.log(
[...document.querySelector('img').attributes].map(attr => attr.nodeName)
);
/* Output console formatting */
.as-console-wrapper { position: absolute; top: 0; }
