Implementing Mozilla's toSource() method in Internet Explorer

后端 未结 8 898
轮回少年
轮回少年 2020-11-27 07:41

Has anyone implemented Mozilla\'s Object.toSource() method for Internet Explorer and other non-Gecko browsers? I\'m looking for a lightweight way to serialize simple object

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 07:43

    If you need to serialise objects with circular references you can use the cycle.js extension to the JSON object by Douglas Crockford available at https://github.com/douglascrockford/JSON-js. This works very like toSource(), although it won't serialise functions (but could probably be adapted to using a function's toString method).

提交回复
热议问题