(element, index)
| 224 | }); |
| 225 | } |
| 226 | function insertChildren(element, index) { |
| 227 | var children = element.selectAll(function () { |
| 228 | return element.node().childNodes; |
| 229 | }); |
| 230 | children = children.data(function (d) { |
| 231 | return d.children; |
| 232 | }, function (d) { |
| 233 | return d.tag + '-' + index; |
| 234 | }); |
| 235 | var childrenEnter = children.enter().append(function (d) { |
| 236 | return createElement(d); |
| 237 | }); |
| 238 | var childrenExit = children.exit(); |
| 239 | childrenExit = childrenExit.remove(); |
| 240 | children = childrenEnter.merge(children); |
| 241 | var childTagIndexes = {}; |
| 242 | children.each(function (childData) { |
| 243 | var childTag = childData.tag; |
| 244 | if (childTagIndexes[childTag] == null) { |
| 245 | childTagIndexes[childTag] = 0; |
| 246 | } |
| 247 | var childIndex = childTagIndexes[childTag]++; |
| 248 | attributeElement.call(this, childData, childIndex); |
| 249 | }); |
| 250 | } |
| 251 | function attributeElement(data) { |
| 252 | var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; |
| 253 | var element = d3__namespace.select(this); |
no test coverage detected