Hacker News new | past | comments | ask | show | jobs | submit login

In what way is that not an issue? What happens when you use .outerHTML to get a string representation of the element? Not to mention that, unavoidably, the entire page HTML arrives to the browser as a string.



Same is true of real javascript objects vs JSON. For example, you can't put Date() in JSON. Nor objects with a prototype.


I do want to point out for those who don't know, on objects with a prototype (such as a class) you can control how JSON.stringify works by adding a special method `toJSON`[0] which will control how that object is serialized.

[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...


Right… and that’s an issue people have to work around every day. Non string values in HTML world similarly be an issue everyone would have to work around.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: