Add replaceWith to methods that trigger afterAttach