## 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 = Action.objects.create(team=self.team, name="watch movie")
        ActionStep.objects.create(action=action, selector="a[data-id='whatever']")
        action2 = Action.objects.create(team=self.team, name="watch movie2")
        ActionStep.objects.create(action=action2, selector="a[somethingelse='whatever']")
        Person.objects.create(distinct_ids=["watched_movie"], team=self.team)
        event = Event.objects.create(
            team=self.team,
            distinct_id="whatever",
            elements=[Element(tag_name="a", attributes={"attr__data-id": "whatever"})],
        )
        self.assertEqual(event.actions, [action])
    def test_event_filter(self):
        action_user_paid = Action.objects.create(team=self.team, name="user paid")
        ActionStep.objects.create(action=action_user_paid, event="user paid")
        Person.objects.create(distinct_ids=["user_paid"], team=self.team)
        event = Event.objects.create(event="user paid", distinct_id="user_paid", team=self.team)
        self.assertEqual(event.actions, [action_user_paid])
    def test_element_class_set_to_none(self):
        action_user_paid = Action.objects.create(team=self.team, name="user paid")
        ActionStep.objects.create(action=action_user_paid, selector="a.something")
        Person.objects.create(distinct_ids=["user_paid"], team=self.team)
        event = Event.objects.create(
            event="$autocapture",
            distinct_id="user_paid",
            team=self.team,
            elements=[Element(tag_name="a", attr_class=None)],
        )
        
        self.assertEqual(event.actions, [])
class TestPreCalculation(BaseTest):