Get a DOM element's or an SVG Element's dataset. Works where .dataset isn't present such as in < IE11.
npm install get-datasetRequire get-dataset:
var getDataset = require("get-dataset");Given this element:
<div class="myDiv" data-prop="value1" data-composed-prop="value2"></div>To retrieve the dataset:
getDataset(document.querySelector(".myDiv"));returns:
{
prop: "value1",
composedProp: "value2"
};- Fix doc
- Fix bug where properties of the returned object weren't camelcased. Issue #1.
MIT