This might not be the answer you are looking for, but to give you some pointers, Safari browser adds an "External Style Sheet" for your page.
Let's say in stackoverflow, and I deleted this "The Overflow Blog " on the right side.
It will generate this css.
DIV[data-tracker='cb=1'] {
display: none !important;
}
However, if I delete this extra stylesheet, the contents will still be hidden, and I assume something within Safari holds data to hide the chosen content. The stylesheet is most likely to remove the element from the browser so that "collectives" will move up.
I guess that's why your code couldn't detect any changes since there weren't any actual DOM manipulations.
Hopefully you find this helpful.