anthonyshort-attributes

Get the attributes of a DOM node as an object

Usage no npm install needed!

<script type="module">
  import anthonyshortAttributes from 'https://cdn.skypack.dev/anthonyshort-attributes';
</script>

README

attributes

Get an object of all attributes on a DOM element

API

var attributes = require('attributes');
var el = document.querySeletor('#foo');

var attrs = attributes(el);

/*
{
    'id': 'foo',
    'class': 'bar',
    'data-component': 'dialog'
}
*/