Made appendElementWithProperties() return the created element.