Public
Edited
Apr 24, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
findExpressionChart(all, target)
Insert cell
{
const expressionText = getHtml1(getMath1(renderExpression(target)));
return htl.html`<pre>${prettify(`<div><h1>dog</h1></div>`)}</pre>`;
}

Insert cell
findExpressionChart = (chart, expression) => {
const expressionText = getHtml1(getMath1(renderExpression(expression)));
console.log("expression:\n", prettify(expressionText));
const chartText = getHtml1(getMath1(chart));
console.log("chart:\n", prettify(chartText));

function find(element) {
const test = getHtml1(element);
console.log({ eq: test === expressionText });
console.log("test:\n", prettify(test));

if (test === expressionText) {
console.log({ found: element });
return element;
}

for (let child of element.children) {
const found = find(child);
if (!!found) return found;
}
return null;
}

return find(getMath1(chart));
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more