Use event.target as a default for event.layer

In 2464d13, event.layer is overwritten to equal event.target. This commit uses event.target as a default for event.layer. Closes #2252