In the New Yorker, "Judging Humor" describes the complexities of litigating humor:
In adjudicating disputes about humor, courts often must decide
whether a particular communication is, indeed, funny. The cases are
diverse, based on theories ranging from contract, trademark
infringement, and sexual harassment to defamation.
A remarkable trend appears in these cases: they tend to track wisdom
about humor developed by decades, even centuries, of humor scholars.
Humor scholars have toiled to find the essence of humor, the quality
that transforms a communication into something that inspires laughter.
Most scholars agree that incongruity is a necessary (though not
sufficient) part of all comedy. The unlikely juxtaposition of two parts
of life, it turns out, gives the spark that creates a joke. Of course,
the conditions must be right for the spark to work: timing, context, and
the like.