- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 25 Sep 2009 10:45:31 -0400
- 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 UTC