There’s the variable containerdom
with a DIV inside which my widget is rendered. I attach a callback function to the widget’s “render” event. In the callback I call containerdom.querySelector()
to get the widget element that was just rendered.
Sometimes, usually after restarting Firefox, querySelector()
returns null, but if I add a conditional breakpoint when it’s null and re-inspect containerdom
and call querySelector()
again it returns the element this time.
treetabledom = containerdom.querySelector('.widget-treetable-wrapper');
if (!treetabledom) {
console.info(containerdom.outerHTML); // missing
debugger;
console.info(containerdom.outerHTML); // present
var treetabledom2 = containerdom.querySelector('.widget-treetable-wrapper');
treetabledom = treetabledom2;
}
What’s causing it and how to fix this?