## Bug description

*Please describe.*  
*If this affects the front-end, screenshots would be of great help.*  

Trailing spaces in the selector box are not removed automatically and can mess up the event results when saving an action

## Expected behavior



## How to reproduce

1. Create a new action with any selector
2. put in a couple of spaces at the end of the line in the selector input box
3. 

## Environment

- Self-managed?
- PostHog version/commit

## Additional context



#### *Thank you* for your bug report – we love squashing them!

posthog/test/test_event_model.py
action_watch_movie = Action.objects.create(team=self.team, name="watched movie")
        ActionStep.objects.create(action=action_watch_movie, tag_name="a", href="/movie")
        person = Person.objects.create(distinct_ids=["anonymous_user", "is_now_signed_up"], team=self.team)
        event_watched_movie_anonymous = Event.objects.create(
            distinct_id="anonymous_user", team=self.team, elements=[Element(tag_name="a", href="/movie")],
        )
        event_watched_movie = Event.objects.create(
            distinct_id="is_now_signed_up", team=self.team, elements=[Element(tag_name="a", href="/movie")],
        )
        events = Event.objects.filter_by_action(action_watch_movie)
        self.assertEqual(events[0], event_watched_movie)
        self.assertEqual(events[0].person_id, person.pk)
    def test_no_person_leakage_from_other_teams(self):
        action_watch_movie = Action.objects.create(team=self.team, name="watched movie")
        ActionStep.objects.create(action=action_watch_movie, event="user signed up")
        person = Person.objects.create(distinct_ids=["anonymous_user"], team=self.team)
        event_watched_movie_anonymous = Event.objects.create(
            event="user signed up", distinct_id="anonymous_user", team=self.team
        )
        team2 = Team.objects.create()
        person2 = Person.objects.create(distinct_ids=["anonymous_user"], team=team2)
        events = Event.objects.filter_by_action(action_watch_movie)
        self.assertEqual(len(events), 1)
        self.assertEqual(events[0].person_id, person.pk)
class TestElementGroup(BaseTest):