compose-dataset-shim

Shims the DOM with support for dataset

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
compose-dataset-shim
001.0.09 years ago9 years agoMinified + gzip package size for compose-dataset-shim in KB

Readme

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 (i === 'dataset') {alert('iterated an Element object');}
}
for (var i in Element.prototype) {
    if (i === 'dataset') {alert('iterated the Element prototype');}
}
 
 
try {
    alert(h.dataset.abCd)
}catch(e) {alert(e);}
 
h.dataset.abCd = 'abc';
alert(h.dataset.abCd)
    
</script>