Event: Handle events only on element nodes and document, fixes #14986.