convert_domain doesn't work with tuple instead of list in domain

Use a cleaner algorithm to parse the domain without testing the type.

issue3950
review5341003