Properly store element attributes when parsing