Created
December 1, 2011 18:24
-
-
Save Raynos/1418758 to your computer and use it in GitHub Desktop.
DOM data stores
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var uuid = 0, | |
domShimString = "__domShim__"; | |
var dataManager = { | |
_stores: {}, | |
getStore: function _getStore(el) { | |
var id = el[str]; | |
if (id === undefined) { | |
return this._createStore(el); | |
} | |
return this._stores[str + id]; | |
}, | |
_createStore: function _createStore(el) { | |
var store = {}; | |
this._stores[str + uuid] = store; | |
el[str] = uuid; | |
uuid++; | |
return store; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment