Why Observable does not render as expected

I am trying to create a notebook here and the CSS animation does not apply at all in the notebook.

I expect to see this (this is what browser returns)

it’s because the svg node is not in the DOM yet when you call document.querySelectorAll(".test > text")

You could yield it on the line before (with yield svg.node();), but that’s not the recommended pattern; it would be better probably to keep the code as a normal function, and replace document.querySelectorAll(".test > text") with svg.node().querySelectorAll(".test > text")

1 Like

Thanks @Fil