Fixes #8335. Do not allow add data to non-elements (2.x). Closes gh-1232