code: function (elm, rels) {
          var viewPortRect = DomUtils.getViewPort();
  
          for (var i = 0; i < rels.length; i++) {
            var pos = calculateRelativePosition(this, elm, rels[i]);
  
            if (this.state.get('fixed')) {
              if (pos.x > 0 && pos.x + pos.w < viewPortRect.w && pos.y > 0 && pos.y + pos.h < viewPortRect.h) {
                return rels[i];
              }
            } else {
              if (pos.x > viewPortRect.x && pos.x + pos.w < viewPortRect.w + viewPortRect.x &&
                pos.y > viewPortRect.y && pos.y + pos.h < viewPortRect.h + viewPortRect.y) {
                return rels[i];
              }
            }
          }
  
          return rels[0];
        }
docs: Tests various positions to get the most suitable one.
  
  @method testMoveRel
  @param {DOMElement} elm Element to position against.
  @param {Array} rels Array with relative positions.
  @return {String} Best suitable relative position.