Renamed Elem#attr_names to valid_attrs and extracted Elem#check_attr.
Moved InvalidAttrError to module root.