handle self-closing element as well