Hi,

Native JSON encoding in WbKit based browsers is a bit different from
the others - if an object that is being encoded contains a host object
(DOM elements etc.), then the encoding fails and a TypeError is cast.

When other browsers simply skip host objects (treated as being empty
"{}"), then WebKit is actually trying to serialize these and ends up
with recursions (element.ownerDocument.body.ownerDocument etc.).

For example JSON.stringify({elm: document.createElement("div"}) ends
up with an error in WebKit but not in other browsers. See my testpage
here http://node.ee/json.html

I filed a bug to V8 (http://code.google.com/p/v8/issues/detail?
id=1223) but it was rejected as WorkingAsIntended and I don't blame
them, there really isn't any specs defining correct behavior for this.

The question is, should Prototype address it or is it a developers
problem? Isn't the work of a JS library to smooth out these kind of
inconsistencies - for example either falling back to a non native
encoder with WebKit or forcing other browser to follow the same rules?

Best regards,
Andris Reinman

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en

Reply via email to