handle tag attributes in elements array