Instead of relying on an attribute that is not always there, check for the passed widget and decide which class to add.