Make repetition use component's classList when available

otherwise the classes that get changed on an element, but not on its
component, get overwritten by the classList of the component later.
Merge pull request #1253

Allows the child elements of the iteration template to be a mix of pure
elements and elements controlled by components, where the repetition manages
the underlying class list directly only if the element does not have a
component of its own.