MILYN-648 Only execute clean-up handlers targeted at element.

Add a unit test illustrating the issue.