Fix #8335: Avoid memory leak by never setting data on non-element non-document nodes. Close gh-1127.
Ref cc324abf: use acceptData to determine when it is safe to add event handlers