Make use of the list of Atoms in the class attribute in selector matchin...

...g.

Fixes #3111
@jdm Thanks it worked :)