Fix bug where container listeners on element never detached and add unit test