I recently started using dean edwards base.js for organizing my program into objects. I must say, base.js is truly amazing! But now I have a question that doesn't require prior knowledge of base.js to answer.
Within one of my objects, I have a property called ref
which holds a reference to a DOM element. This object needs to be serialized as JSON using JSON.stringify
, but the presence of circular structures within DOM elements makes it impossible to convert the object to JSON.
To overcome this issue, I have implemented a method called html()
to return the ref
property. However, I need ref
to be a private property accessible only within the object, ensuring it is not included in the JSON serialization process by stringify
.
Can anyone suggest the best approach to achieve this?