W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: More questions about contextual reference nodes

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 14 Apr 2011 14:40:38 -0400
Message-ID: <4DA73FA6.6060605@mit.edu>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
CC: public-webapps <public-webapps@w3.org>
On 4/13/11 5:43 AM, Lachlan Hunt wrote:
> I didn't think so, but then perhaps I misunderstand what the spec means
> by a native object. ECMAScript defines a native object as
> "object in an ECMAScript implementation whose semantics are fully
> defined by this specification rather than by the host environment."
> So that would include things like Array, String, etc.


> I don't think NodeList fits that definition, since it's provided by the host
> environment, not ECMAScript.

That's correct.

> I also thought something like this would not be a native object either:
> function init() {
> ...
> }
> var x = new init();

That's a native object; the behavior of that set of operations is 
completely defined by the ES spec.

> JQuery more or less does that to create an object with custom
> properties, and then basically uses Array.prototype.push.apply(x, elms)
> to add the collection to that object.

Right; jquery's got native objects there.

> It's nice so that cases where authors try to pass in an array of things
> that aren't nodes are handled well. The other alternative is just to
> accept a collection of anything, and iterate through it to find all the
> Element nodes, ignoring everything else. I don't see any reason to
> prefer the latter approach.

I would really prefer we not do the latter.

Received on Thursday, 14 April 2011 18:41:07 UTC

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