Handling ending blank spaces in MutationObserver