Years ago when my son was two or three years old I was frustrated with his father. I don't recall what I was frustrated about but I let it slip in front of my son that I thought his father was a jerk. Oops! What a huge mistake. My little boy took me to task over it. He said that I was not allowed to call his daddy names and that I should have a time out. Out of the mouths of babes.
How right he was. I slipped. I goofed. I messed up. It was over 12 years ago but I still cringe when I think about it. How I hurt my little boy by calling his father anything less than wonderful. I never did it again. He put me in my place very nicely thank you.
When couples split it is easy to get wrapped up in the arguing and hurt that each other is causing. This should never be express to the children no matter how young or old they are. By making negative comments about your ex you are making negative comments about your child. Or at least that is how you should think about it. The child is half of both parents and at the earlier ages they identify solely through there parents.
Instead of running off at the mouth save complaining about an ex for times when you are alone with a friend. When with children it is important to tell them how wonderful their other parent is even if you have to gag to say it. You don't even have to believe it but your kids do and will. And remember, there was a time when this other person meant the world to you too. They do have great qualities they just happened to be masked by all the bickering. In time these qualities will show themselves again and are always there for the child.