compose-dataset-shim

1.0.0 • Public • Published

dataset-shim

Shims the dataset property for DOM nodes. This was copied from brettz9's gist.

Usage:

<!DOCTYPE html>
 
<script src="html5-dataset.js"></script>
 
<h3 id="hd" data-ab-cd="zzz">Test!</h3>
 
<script>
var h = document.getElementById('hd');
 
for (var i in h) {
    if (=== 'dataset') {alert('iterated an Element object');}
}
for (var i in Element.prototype) {
    if (=== 'dataset') {alert('iterated the Element prototype');}
}
 
 
try {
    alert(h.dataset.abCd)
}catch(e) {alert(e);}
 
h.dataset.abCd = 'abc';
alert(h.dataset.abCd)
    
</script> 

Readme

Keywords

none

Package Sidebar

Install

npm i compose-dataset-shim

Weekly Downloads

301

Version

1.0.0

License

MIT

Last publish

Collaborators

  • imathis
  • jeromegn
  • compose