Change from TNode/TElement::with_element() to as_element().

Fix #1828