W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

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

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Mon, 12 Dec 2011 12:46:01 +0100
Message-ID: <4EE5E979.7050800@lachy.id.au>
To: Marcos Caceres <w3c@marcosc.com>
CC: Glenn Adams <glenn@skynav.com>, WebApps WG <public-webapps@w3.org>
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
Received on Monday, 12 December 2011 11:49:07 UTC

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