It would be nice to be able to use the *
character as a wildcard in calls to .removeClass()
.
For example, elem.removeClass('foo-*')
would remove all classes that start with foo-
.
Currently, the easiest way to do this seems to be the following, which is neither elegant nor efficient:
.removeClass(function (_, cl) { return cl.split(' ').filter(function (c) { return c.substr(0, "foo-".length) === "foo-"; }).join(' '); })