@artur this code doesn’t appear to work when targeting header blocks.
I’ve tried a handful of different approaches in this topic and I haven’t been able to get it to work.
Using a DOMContentLoaded event works, but for some reason Safari has a hard time finding the HTML element to update (separate issue).