core/dom.js
function getRect(elem) {
  if (elem && !elem.nodeType) {
    elem = elem[0];
  }

  if (!elem || 1 !== elem.nodeType) {
    return false;
  }

  var bounds = elem.getBoundingClientRect();

  return {
    height: bounds.bottom - bounds.top,
    width: bounds.right - bounds.left,
    top: bounds.top,
    left: bounds.left
  };
}
function getRect(elem) {
  if (elem && !elem.nodeType) {
    elem = elem[0];
  }

  if (!elem || 1 !== elem.nodeType) {
    return false;
  }

  var bounds = elem.getBoundingClientRect();

  return {
    height: bounds.bottom - bounds.top,
    width: bounds.right - bounds.left,
    top: bounds.top,
    left: bounds.left
  };
}
function getRect ( elem ) { if ( elem && ! elem . nodeType ) { elem = elem [ 0 ] ; } if ( ! elem || 1 !== elem . nodeType ) { return false ; } var bounds = elem . getBoundingClientRect ( ) ; return { height : bounds . bottom - bounds . top , width : bounds . right - bounds . left , top : bounds . top , left : bounds . left } ; }
Calculate the rectangle of the element with an optional buffer.
@param {Element} elem The element.
@param {number} buffer An extra padding.
Calculate the rectangle of the element with an optional buffer .