Widget: Avoid adding extra spaces to the result of this._classes(...)

This is a PR on top of a PR (#1369).