Fix assert when foster parenting self-closing elements