3 ms·
> JSON.stringify(document.body) One of two things will happen, depending on your browser. If your browser is following the WebIDL spec, so all the accessors a
by bzbarsky 13y ago
> JSON.stringify(document.body)
One of two things will happen, depending on your browser.
If your browser is following the WebIDL spec, so all the accessors are on the prototype, this will produce "{}".
If your browser is WebKit-based, this will throw an exception, because body.firstChild.parentNode == body and JSON.stringify throws on object graphs with loops.
- TazeTSchnitzel 13y agoAw, damn. I didn't realise it was all fake properties, I thought that would produce something.
- bzbarsky 13y agoNothing fake about accessor properties. Means you can lazily generate the string for .innerHTML and such, though!