docs: function( p, dir, desired, s, best ) {
          var result, r, diff, desiredForArrow = {}, tip = {};
  
          // If the arrow has no wiggle room along the edge of the popup, it cannot
          // be displayed along the requested edge without it sticking out.
          if ( s.arFull[ p.dimKey ] > s.guideDims[ p.dimKey ] ) {
              return best;
          }
  
          desiredForArrow[ p.fst ] = desired[ p.fst ] +
              ( s.arHalf[ p.oDimKey ] + s.menuHalf[ p.oDimKey ] ) * p.offsetFactor -
              s.contentBox[ p.fst ] + ( s.clampInfo.menuSize[ p.oDimKey ] - s.contentBox[ p.oDimKey ] ) * p.arrowOffsetFactor;
          desiredForArrow[ p.snd ] = desired[ p.snd ];
  
          result = s.result || this._calculateFinalLocation( desiredForArrow, s.clampInfo );
          r = { x: result.left, y: result.top };
  
          tip[ p.fst ] = r[ p.fst ] + s.contentBox[ p.fst ] + p.tipOffset;
          tip[ p.snd ] = Math.max( result[ p.prop ] + s.guideOffset[ p.prop ] + s.arHalf[ p.dimKey ],
              Math.min( result[ p.prop ] + s.guideOffset[ p.prop ] + s.guideDims[ p.dimKey ] - s.arHalf[ p.dimKey ],
                  desired[ p.snd ] ) );
  
          diff = Math.abs( desired.x - tip.x ) + Math.abs( desired.y - tip.y );
          if ( !best || diff < best.diff ) {
              // Convert tip offset to coordinates inside the popup
              tip[ p.snd ] -= s.arHalf[ p.dimKey ] + result[ p.prop ] + s.contentBox[ p.snd ];
              best = { dir: dir, diff: diff, result: result, posProp: p.prop, posVal: tip[ p.snd ] };
          }
  
          return best;
      }