Returns true if prospectiveChild can be legally added to parent. False is returned if:

  • parent and prospectiveChild are equal
  • parent already contains prospectiveChild
  • prospectiveChild has parent as its own child

Throws an error if parent or prospectiveChild is null/undefined.