W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2009

Re: [selectors-api] Scoped Selectors

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 25 Sep 2009 10:45:31 -0400
Message-ID: <4ABCD78B.3010502@mit.edu>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
CC: public-webapps <public-webapps@w3.org>
On 9/25/09 9:59 AM, Lachlan Hunt wrote:
> Yes, the reference elements parameter will accept either a single
> element, Array or NodeList.

What about HTMLCollection?  Or have we finally made that interface 
inherit from NodeList?

Another question I just had reading this, and this is probably a webidl 
question, not a selectors API question, is what makes something an 
element, array, or nodelist.  First off, what if some spec introduces 
objects that implement both the Element and NodeList interfaces? 
Second, what if I do:

   function foo() {
   }
   foo.prototype = Array.prototype
   var myObj = new foo();

Is that an array?  How should the callee be able to determine this?

What about:

   var elm = document.createElement("div");
   function foo() {
   }
   foo.prototype = elm;
   var myObj = new foo();

For what it's worth, it looks like in this case 
myObj.appendChild(document.createTextNode("test")) appends to |elm| in 
Gecko and Google Chrome, throws WRONG_THIS_ERR in Opera, and throws 
"Type error" in Safari.  Doing document.body.appendChild(myObj) throws 
WRONG_ARGUMENTS_ERR in Opera, throws NOT_FOUND_ERR in Safari and Chrome, 
and throws HIERARCHY_REQUEST_ERR in Gecko....  How is this case 
different from the array case, if at all?

-Boris
Received on Friday, 25 September 2009 14:46:37 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:33 GMT