## 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
def test_create_elements(self):
        elements = [
            Element(tag_name="button", text="Sign up!",),
            Element(tag_name="div",),
        ]
        group1 = ElementGroup.objects.create(team=self.team, elements=elements)
        elements = list(Element.objects.all())
        self.assertEqual(elements[0].tag_name, "button")
        self.assertEqual(elements[1].tag_name, "div")
        elements = [
            Element(tag_name="button", text="Sign up!",),
            
            Element(tag_name="div", event=Event.objects.create(team=self.team),),
        ]
        group2 = ElementGroup.objects.create(team=self.team, elements=elements)
        self.assertEqual(Element.objects.count(), 2)
        self.assertEqual(group1.hash, group2.hash)
        
        team2 = Team.objects.create()
        group3 = ElementGroup.objects.create(team=team2, elements=elements)
        group3_duplicate = ElementGroup.objects.create(team_id=team2.pk, elements=elements)
        self.assertNotEqual(group2, group3)
        self.assertEqual(group3, group3_duplicate)
        self.assertEqual(ElementGroup.objects.count(), 2)
class TestActions(BaseTest):