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));
}