-
Notifications
You must be signed in to change notification settings - Fork 111
Bump data-set #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump data-set #17
Conversation
|
As an added bonus, I just create 3.0.0 which reduced the size from 10kb to 3kb :) |
|
Since Either the |
|
what changed in dataset? does it store objects as JSON now or something like that? |
|
@dominictarr so This means currently in IE<11 to access data you put in Now due to Which means to read var h = require('hyperscript')
var DataSet = require('data-set')
var assert = require('assert')
var elem = h('div', {
'data-foo': { bar: 'baz' }
});
var ds = DataSet(elem)
assert.deepEqual(ds.foo, { bar: 'baz' })Previously if you accessed |
|
A valid alternative to this PR is to completely remove the dependency on |
|
oh... so are you saying that although data-set started as a polyfill for data- attributes, you have removed that completely and now it's not using that at all? |
|
@dominictarr it started off as a polyfill for data- attributes that was function DataSet(elem) {
return elem.dataset ? dataset : polyfill(elem)
}Now it's function DataSet(elem) {
return polyfill(elem)
}The polyfill always weakly attached the dataset to the element. The important back compat breaking change is ( npm-dom/data-set@3f0ec1a ) |
|
right - so it's not a polyfil anymore! it's just a weakmap! but it looks like it's it's a polyfil. Is there another way you can use weakmaps like you are without me merging this? |
|
@dominictarr thinking about it more I think I should close this and you should remove |
This increments data-set to version 3.0.0
Previously this would fail
h("foo", { 'data-foo': { 'some': 'object' } })because the native browser dataset would serialize non string values to strings.data-set v3.0 fixes this and you can correctly store objects on an element and later retrieve them using the
'data-set'module.This is a back compat breaking change as people can no longer access their
'data-*'keys in.datasetcompliant browsers usingelem.dataset.foothey have to useDataSet(elem).fooRecommend major version bump if accept.