Re: More questions about contextual reference nodes

2011-04-14 Thread Boris Zbarsky
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

Re: More questions about contextual reference nodes

2011-04-14 Thread Boris Zbarsky
On 4/13/11 6:20 AM, Lachlan Hunt wrote: Which conversion algorithm applies here? Is it 4.1.15. object, or 4.1.16. Interface types? http://dev.w3.org/2006/webapi/WebIDL/#es-object The latter, since Node is an interface type. -Boris

Re: More questions about contextual reference nodes

2011-04-14 Thread Cameron McCormack
Lachlan Hunt: However, with the way in which the IDL is overloaded, it's not clear to me which of the two overloaded methods gets invoked when the parameter is null. The IDL says: querySelector(in DOMString selectors, in optional Element refElement); querySelector(in DOMString

Re: More questions about contextual reference nodes

2011-04-13 Thread Lachlan Hunt
On 2011-04-13 04:43, Cameron McCormack wrote: Lachlan Hunt: This seems to differ from the algorithm given for T[], which requires that the object be either an array host object or a native object, which would not handle the JQuery case. The sequenceT type seems more generic than that as the

Re: More questions about contextual reference nodes

2011-04-13 Thread Lachlan Hunt
On 2011-04-13 06:32, Cameron McCormack wrote: Lachlan Hunt: OK. Then I'm not sure what the practical difference between the Element[] or sequenceElement would be then, nor which one to use. ... the only difference is that with Element[] you can distinguish between null and an array of

Re: More questions about contextual reference nodes

2011-04-12 Thread Cameron McCormack
Lachlan Hunt: I reviewed WebIDL again, and I think I've started to understand the difference between sequenceT and T[] now. As I understand it, the algorithm to convert an ECMAScript object to an IDL sequence should work with any object that has a length property and indexed values

Re: More questions about contextual reference nodes

2011-04-12 Thread Boris Zbarsky
On 4/10/11 4:30 AM, Lachlan Hunt wrote: Would it be useful, and is it possible to define the refElements parameter to accept any object that contains a .length and indexed properties, just like a JQuery object? Looks like this already got answered, but yes, sequenceNode should make that work.

Re: More questions about contextual reference nodes

2011-04-12 Thread Boris Zbarsky
On 4/10/11 12:02 PM, Lachlan Hunt wrote: I've updated and simplified the spec to handle the above case using the parameter sequenceNode. I still need to update the prose to say that while the collections may contain any Node, only Element nodes are added to the list of contextual reference

Re: More questions about contextual reference nodes

2011-04-12 Thread Cameron McCormack
Lachlan Hunt: OK. Then I'm not sure what the practical difference between the Element[] or sequenceElement would be then, nor which one to use. Boris Zbarsky: I'm not either. That's why Cameron is cced. If you are choosing between those two for the type of an argument, and you don’t have

Re: More questions about contextual reference nodes

2011-04-12 Thread Cameron McCormack
Cameron McCormack: then the only difference is that with Element[] you can distinguish between null and an array of length 1, while with sequenceElement you can’t. Length 0, not 1. -- Cameron McCormack ≝ http://mcc.id.au/

Re: More questions about contextual reference nodes

2011-04-10 Thread Lachlan Hunt
On 2011-04-09 19:14, Boris Zbarsky wrote: On 4/9/11 6:27 AM, Lachlan Hunt wrote: There were cases in JQuery where the script wanted to iteratively run a selector on all nodes in a collection, and return elements that are descendants of those elements. This allows :scope to be used in those

Re: More questions about contextual reference nodes

2011-04-10 Thread Lachlan Hunt
On 2011-04-10 13:30, Lachlan Hunt wrote: But is jquery's collection a JS Array? The object returned by the $() function isn't an array. It's a custom object that mimics the functionality of an array... var p = $(p.foo) Var a = $(a); a[0].matchesSelector(:scopea, p) ... Would it be useful, and

Re: More questions about contextual reference nodes

2011-04-10 Thread Ms2ger
On 04/09/2011 07:14 PM, Boris Zbarsky wrote: On 4/9/11 6:27 AM, Lachlan Hunt wrote: I also have to include one for HTMLCollection, which doesn't inherit from NodeList. Yeah, that's broken... I wonder whether we can just fix that in Web DOM Core or something If people are willing to

More questions about contextual reference nodes

2011-04-09 Thread Boris Zbarsky
I have two questions about http://www.w3.org/TR/selectors-api2/#determine-contextual-reference-nodes 1) What are the use cases for supplying more than one contextual reference node, exactly? It seems weird to allow more than one node to match :scope. 2) If we do want to allow the

Re: More questions about contextual reference nodes

2011-04-09 Thread Lachlan Hunt
On 2011-04-09 10:12, Boris Zbarsky wrote: I have two questions about http://www.w3.org/TR/selectors-api2/#determine-contextual-reference-nodes 1) What are the use cases for supplying more than one contextual reference node, exactly? It seems weird to allow more than one node to match :scope.

Re: More questions about contextual reference nodes

2011-04-09 Thread Boris Zbarsky
On 4/9/11 6:27 AM, Lachlan Hunt wrote: There were cases in JQuery where the script wanted to iteratively run a selector on all nodes in a collection, and return elements that are descendants of those elements. This allows :scope to be used in those cases by passing the collection as the