You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are useful apis that obsolete expandos and jQueries hideous method that also doesn't allow proper garbage collection of the JS objects when they're object graph is isolated to DOM nodes aside from the cache that keeps them alive. It's available in Firefox but apparently nowhere else I'vee been able to find and I'm not sure why.
I've done a couple test implementations of it. One relies on WeakMaps to supply the storage, another uses addEventListener and a custom event to create a storage that is only referenced by the DOM node it lives inside as part of being a registered event listener.
The remainder of interfaces and interface members listed in this section were removed to simplify the DOM platform. Implementations conforming to this specification will not support them.
...
getUserData
setUserData
As nice as those methods are they are deprecated in DOM4.
wtf how did I miss that. Also dataset just stores strings. There's not other way provided by the DOM to specifically associate JS objects with a DOM element such that when the DOM element dies so does the data. Oh well, these shims will work for the time being.
https://developer.mozilla.org/En/DOM/Node.setUserData
These are useful apis that obsolete expandos and jQueries hideous method that also doesn't allow proper garbage collection of the JS objects when they're object graph is isolated to DOM nodes aside from the cache that keeps them alive. It's available in Firefox but apparently nowhere else I'vee been able to find and I'm not sure why.
I've done a couple test implementations of it. One relies on WeakMaps to supply the storage, another uses addEventListener and a custom event to create a storage that is only referenced by the DOM node it lives inside as part of being a registered event listener.
The WeakMap one is here: https://github.com/Benvie/svgstuff/blob/master/lib/user-data.js
The event based one isn't complete, but the core principle is demonstrated here: https://gist.github.com/2586308
The text was updated successfully, but these errors were encountered: