[UPDATE] modified API for self-closing elements.