Skip to content

Commit 4b3cd6a

Browse files
authored
Merge pull request microsoft#14641 from cedvdb/master
Added `entries`, `foreach`, `values` and `keys` to NodeListOf
2 parents 2b10611 + e8b6e8b commit 4b3cd6a

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/lib/dom.iterable.d.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,53 @@ interface DOMTokenList {
55
}
66

77
interface NodeList {
8+
9+
10+
/**
11+
* Returns an array of key, value pairs for every entry in the list
12+
*/
13+
entries(): IterableIterator<[number, Node]>;
14+
/**
15+
* Performs the specified action for each node in an list.
16+
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list.
17+
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
18+
*/
19+
forEach(callbackfn: (value: Node, index: number, listObj: NodeList) => void, thisArg?: any): void;
20+
/**
21+
* Returns an list of keys in the list
22+
*/
23+
keys(): IterableIterator<number>;
24+
25+
/**
26+
* Returns an list of values in the list
27+
*/
28+
values(): IterableIterator<Node>;
29+
30+
831
[Symbol.iterator](): IterableIterator<Node>
932
}
1033

1134
interface NodeListOf<TNode extends Node> {
35+
36+
/**
37+
* Returns an array of key, value pairs for every entry in the list
38+
*/
39+
entries(): IterableIterator<[number, TNode]>;
40+
41+
/**
42+
* Performs the specified action for each node in an list.
43+
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list.
44+
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
45+
*/
46+
forEach(callbackfn: (value: TNode, index: number, listObj: NodeListOf<TNode>) => void, thisArg?: any): void;
47+
/**
48+
* Returns an list of keys in the list
49+
*/
50+
keys(): IterableIterator<number>;
51+
/**
52+
* Returns an list of values in the list
53+
*/
54+
values(): IterableIterator<TNode>;
55+
1256
[Symbol.iterator](): IterableIterator<TNode>
1357
}

0 commit comments

Comments
 (0)