Do not allow add data to non-elements, fixes #8335 for 2.0