refactor no. 2

now we pass the new element to the after-add hook, and the hooks
themselves are tied to the parent div