When I stringify a JQuery collection, it produces what appears to be a reference ID:
JSON.stringify($('.btn'));
> '{"0":{"jQuery360064998935415166481":{"events":{"click":[...
Obviously calling parse on this string will not produce a true JQuery object reference. I’m curious if you can use this string identifier to obtain a reference to the original object, assuming the original object as still allocated? What do these jQuery360064998935415166481 style identifiers represent?
I’m working with WASM where passing object references has limitations and requires unique approaches to fake preserve/restore handles to objects, and am wondering if these identifiers would be useful in my toolkit of approaches of overcoming these limitations. I’d appreciate it greatly if we can avoid devolving into a discussion about the premise of the question.
2
Answers
I'm not marking this as answer because I don't know that it's completely reliable or why it over-fetches in some cases. It at least shows that it is possible to take the string expando ID and locate the object, and could probably be refined into something reliable:
https://jsfiddle.net/3hwvor46/
core.js
fileBasically: