(a) Any evidence of a past or present act of domestic violence, whether or not committed in the presence of the child, is a relevant factor that must be considered by the court in determining the legal custody and residential arrangements in accordance with the best interests of the child.
(b) If sole or joint custody is awarded to, or if primary residence of a child is placed with, a party notwithstanding evidence that the party has committed acts of domestic violence against the other parent, against the child or against any other person living in the child’s household, the court shall make specific written findings in support of the decision to award custody or primary residence to that party.