Check if an event came from within an element.