W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: QSA, the problem with ":scope", and naming

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 31 Oct 2011 21:51:29 -0400
Message-ID: <4EAF50A1.1070406@mit.edu>
To: Charles Pritchard <chuck@jumis.com>
CC: public-webapps@w3.org
On 10/31/11 9:32 PM, Charles Pritchard wrote:
> Structured cloning fails for NodeList, same as postMessage, because of
> circular structure.

What circular structure?  Structured clone can handle that.

It fails because it's a host object (based on its [[Class]]) that's not 
whitelisted in the structured clone algorithm.

> With .join, you get the .toString of the DOM Nodes.

Yes, as you would for an array of DOM nodes.

A quick skim through the ES spec shows that Array.prototype.concat also 
considers the [[Class]] of its arguments, by the way.  And indeed, this 

     var l = document.getElementsByTagName("html");
     var a = Array.prototype.slice.call(l);
     l.__proto__.__proto__ = Array.prototype;
     var test1 = [].concat(l);
     var test2 = [].concat(a);
     alert(test1[0] instanceof HTMLHtmlElement);
     alert(test2[0] instanceof HTMLHtmlElement);

alerts "false" followed by "true" in UAs.

So we really do need to decide what it means for a return value to "be 
an Array".  For example, how does it behave with concat()?

Received on Tuesday, 1 November 2011 01:52:03 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:36 UTC