Check ancestors when button is clicked

In Chrome, if a user clicks on a <button> with child elements, the click target is the child element and not the <button> (if the user clicked precisely on the child element).

This change checks the click target as well as its ancestors, when testing for classes.