The util used to get customise data(by HTML tag's data-attribute).It does not depend on and other javascript frameworks.
The dataset is a util used to get customise data(HTML tag data-attribute).It is very lightly,i hope you will enjoy it :-)
dataset's website:http://qiqicartoon.com/projects/dataset
<div data-type="username" data-age="23" data-userAddress='{"province":"ZheJiang","city":"HangZhou"}' data-vip="true" data-email="null" data-company='{"china":"[\"Alipay\",\"Taobao\"]"}' data-avatars='[{"google":["img.png","img2.png"]}]' > </div>
{ type: 'username', {String} age: 23, {Number} userAddress: { {Object} province: 'ZheJiang', city: 'HangZhou' }, vip: true, {Boolean} email: null, {Object} company:{ {Object} "china":["Alipay","Taobao"] }, avatars:[{"google":["img.png","img2.png"]}] {Object} }
dataset(document.querySelectorAll('div')[0])
Yea, so easy!
It does not depend on and other javascript frameworks.
The reason why the dataset is lightly, because the dataset for HTML tag's [data-attribute] made simple encapsulate.
The dataset solves HTML5 element.dataset dont't deal with data type problem.Note that, HTML5 element.dataset put all the customise data are as string return.
The dataset compatible with the lower level of the browser(Don't supported HTML5),such as IE6,IE7 and IE8.
- Chrome all
- Firefox all
- Safari all
- Opera all
- IE6+
- Windows Phone 7 IE
- iOS Safari all
- Android OS browser all
- UC browser 7.9+
Shooting this code to open