In this age of social media, there are an infinite number of ways to communicate and, unfortunately, this creates more places and opportunities for an angry ex, or soon-to-be ex, to bash or harass. In any divorce settlement agreement with children involved, there will be language stating that neither party may talk badly about the other to or in the presence of the children. However, this does not necessarily prohibit someone from making these same comments to all of their "friends" on social media.
There are two words for someone whose soon-to-be ex is bashing them in this fashion - IGNORE IT. This is obviously easier said than done, but there are important reasons to take this high road.
Most importantly, anything you put in writing can be used against you. If your spouse is making negative comments about you online, print them out and bring them to the Judge's attention. If you respond to anything your spouse says, you are only giving him/her the same ammunition against you. However, if you can show the Judge what he/she is doing AND that you have taken the high road and refused to get pulled into the drama, this could swing certain aspects of the divorce in your favor. The parties' behavior can come into play when deciding child custody, equitable division and alimony, and it is always better to come in with your hands clean.
In addition, you are divorcing this person and there is no longer any reason to let them get into your head. There is a reason you are no longer together and part of it may be exactly how he/she is acting in broadcasting things about you to the world. If you find yourself in this unfortunate situation, unfriend your ex, block him/her, or do whatever else you need to do to avoid the negativity. Whether you have children together or not, it is prudent to have a clause in your settlement agreement or divorce decree ordering that neither party may make negative comments to the other in a public forum such as Facebook.