Adding a check to determine if the selector is a string before attempting to call .match().  Prevents an exception when passing in a jquery object.