## 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
)
        event2 = Event.objects.create(
            event="$autocapture",
            team=self.team,
            distinct_id="whatever",
            elements=[
                Element(tag_name="a", nth_child=2, nth_of_type=0, attr_id="someId"),
                Element(tag_name="div", nth_child=0, nth_of_type=0),
                Element(tag_name="div", nth_child=0, nth_of_type=0),
                Element(tag_name="div", nth_child=0, nth_of_type=0),
                Element(tag_name="div", nth_child=0, nth_of_type=0),
                Element(tag_name="div", nth_child=0, nth_of_type=0),
                Element(tag_name="div", nth_child=0, nth_of_type=0),
                
                Element(href="/a-url-2", nth_child=0, nth_of_type=0),
            ],
        )
        
        team2 = Team.objects.create()
        event3 = Event.objects.create(
            event="$autocapture",
            team=team2,
            distinct_id="whatever",
            elements=[
                Element(tag_name="a", nth_child=2, nth_of_type=0, attr_id="someId"),
                Element(tag_name="div", nth_child=0, nth_of_type=0),
            ],
        )
        
        action1 = Action.objects.create(team=self.team, name="action1")