On 10/31/11 7:25 PM, Alex Russell wrote:
For JS, it just means having a working ".length" property (in all the
ways that Arrays allow it to be used). Arrays are identical to other
objects in all other respects.

No, they're not. For example, off the top of my head, they get serialized differently by JSON.stringify. Note that this is based off of the [[Class]] (ES5 section 15.12.3 definition of Str() item 10a). So if you want your object to behave like an array for JSON serialization, it needs to have the right [[Class]].

I'd bet money there are other such things in ES5, for what it's worth.

Structured cloning fails for NodeList, same as postMessage, because of circular structure. With .join, you get the .toString of the DOM Nodes. There is no JSON serialization for DOM elements.


Reply via email to