Insert and append can take functions returning a DOM element

This is specified in the d3 documentation :
- append : https://github.com/mbostock/d3/wiki/Selections#append
- insert : https://github.com/mbostock/d3/wiki/Selections#insert

Also visible in the code : https://github.com/mbostock/d3/blob/master/d3.js#L802 and https://github.com/mbostock/d3/blob/master/d3.js#L818
This commit is contained in:
Guillaume Mouron
2015-05-18 12:07:28 +02:00
parent e42bef3a8f
commit b0289ac7a3
Vendored
+24 -4
View File
@@ -787,8 +787,18 @@ declare module D3 {
(valueFunction: (data: T, index: number) => any): _Selection<T>;
};
append: (name: string) => _Selection<T>;
insert: (name: string, before: string) => _Selection<T>;
append: {
(name: string): _Selection<T>;
(elementFunction: (data: T, index: number) => any): _Selection<T>;
}
insert: {
(name: string, before: string): _Selection<T>;
(insertElementFunction: (data: T, index: number) => any, before: string): _Selection<T>;
(name: string, beforeElementFunction: (data: T, index: number) => any): _Selection<T>;
(insertElementFunction: (data: T, index: number) => any, beforeElementFunction: (data: T, index: number) => any): _Selection<T>;
}
remove: () => _Selection<T>;
empty: () => boolean;
@@ -874,8 +884,18 @@ declare module D3 {
export interface Selection extends _Selection<any> { }
export interface _EnterSelection<T> {
append: (name: string) => _Selection<T>;
insert: (name: string, before?: string) => _Selection<T>;
append: {
(name: string): _Selection<T>;
(elementFunction: (data: T, index: number) => any): _Selection<T>;
}
insert: {
(name: string, before?: string): _Selection<T>;
(insertElementFunction: (data: T, index: number) => any, before?: string): _Selection<T>;
(name: string, beforeElementFunction?: (data: T, index: number) => any): _Selection<T>;
(insertElementFunction: (data: T, index: number) => any, beforeElementFunction?: (data: T, index: number) => any): _Selection<T>;
}
select: (selector: string) => _Selection<T>;
empty: () => boolean;
node: () => Element;