MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / selectChild

Function selectChild

tensorboard/plugins/graph/tf_graph_common/common.ts:119–143  ·  view source on GitHub ↗
(
  container,
  tagName: string,
  className?: string | string[]
)

Source from the content-addressed store, hash-verified

117 * @return selection of the element, or an empty selection
118 */
119export function selectChild(
120 container,
121 tagName: string,
122 className?: string | string[]
123): d3.Selection<any, any, any, any> {
124 let children = container.node().childNodes;
125 for (let i = 0; i < children.length; i++) {
126 let child = children[i];
127 if (child.tagName === tagName) {
128 if (className instanceof Array) {
129 let hasAllClasses = true;
130 for (let j = 0; j < className.length; j++) {
131 hasAllClasses =
132 hasAllClasses && child.classList.contains(className[j]);
133 }
134 if (hasAllClasses) {
135 return d3.select(child);
136 }
137 } else if (!className || child.classList.contains(className)) {
138 return d3.select(child);
139 }
140 }
141 }
142 return d3.select(null);
143}
144
145/**
146 * Given a container d3 selection, select a child svg element of a given tag

Callers 3

buildGroupForSceneFunction · 0.90
positionFunction · 0.90
selectOrCreateChildFunction · 0.85

Calls 1

nodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…