You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+60
Original file line number
Diff line number
Diff line change
@@ -142,6 +142,50 @@ Note that the `:nth-child` pseudo-class is a one-based index rather than a zero-
142
142
143
143
The returned selection may not preserve the index of the original selection, as some elements may be removed; you can use [*selection*.select](#selection_select) to preserve the index, if needed.
Given the specified *selector*, returns a function which returns true if `this` element [matches](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches) the specified selector. This method is used internally by [*selection*.filter](#selection_filter). For example, this:
148
+
149
+
```js
150
+
var div =selection.filter("div");
151
+
```
152
+
153
+
Is equivalent to:
154
+
155
+
```js
156
+
var div =selection.filter(d3.matcher("div"));
157
+
```
158
+
159
+
(Although D3 is not a compatibility layer, this implementation does support vendor-prefixed implementations due to the recent standardization of *element*.matches.)
Given the specified *selector*, returns a function which returns the first descendant of `this` element that matches the specified selector. This method is used internally by [*selection*.select](#selection_select). For example, this:
Given the specified *selector*, returns a function which returns all descendants of `this` element that match the specified selector. This method is used internally by [*selection*.selectAll](#selection_selectAll). For example, this:
178
+
179
+
```js
180
+
var div =selection.selectAll("div");
181
+
```
182
+
183
+
Is equivalent to:
184
+
185
+
```js
186
+
var div =selection.selectAll(d3.selectorAll("div"));
187
+
```
188
+
145
189
### Modifying Elements
146
190
147
191
After selecting elements, use the selection’s transformation methods to affect document content. Selection methods return the current selection, allowing the concise application of multiple methods on a given selection via method chaining. For example, to set the name attribute and color style of an anchor element:
Given the specified element *name*, returns a function which creates an element of the given name, assuming that `this` is the parent element. This method is used internally by [*selection*.append](#selection_append) to create new elements. For example, this:
324
+
325
+
```js
326
+
selection.append("div");
327
+
```
328
+
329
+
Is equivalent to:
330
+
331
+
```js
332
+
selection.append(d3.creator("div"));
333
+
```
334
+
335
+
See [namespace](#namespace) for details on supported namespace prefixes, such as for SVG elements.
336
+
277
337
### Joining Data
278
338
279
339
For an introduction to D3’s data joins, see [Thinking With Joins](http://bost.ocks.org/mike/join/). Also see the [General Update Pattern](http://bl.ocks.org/mbostock/3808218) examples.
0 commit comments