Re: Web IDL sequence<T> and item() method

On 2011-12-11 13:55, Marcos Caceres wrote:
>> On Fri, 09 Dec 2011 19:51:48 +0100, Glenn Adams<glenn@skynav.com (mailto:glenn@skynav.com)>  wrote:
>>> If the answer is that no item() method is implied, then does the use of
>>> sequence<T>  in these newer specs entail dropping this method (with
>>> respect to prior DOM specs)?
>
> I'm also unsure as to the purpose of sequence in practice. Perhaps
> some examples of expected usage would help a bit?

I use it in Selectors API for the refNodes parameter, which needs to 
accept any collection of nodes, whether it be a NodeList, Array, jQuery 
object or any other generic numerically indexed object.

e.g. These should all work

var list = document.getElementsByTagName("section")
document.querySelectorAll(":scope>h1", list)

document.querySelectorAll(":scope>h1", $("section")) // JQuery $()

document.querySelectorAll(":scope>h1", [elm1, elm2, elm3])

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Monday, 12 December 2011 11:49:07 UTC