code: function _getOffset(element) {
      var elementPosition = {};
  
      var body = document.body;
      var docEl = document.documentElement;
  
      var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;
      var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;
  
      if (element instanceof SVGElement) {
          var x = element.getBoundingClientRect();
          elementPosition.top = x.top + scrollTop;
          elementPosition.width = x.width;
          elementPosition.height = x.height;
          elementPosition.left = x.left + scrollLeft;
      } else {
          //set width
          elementPosition.width = element.offsetWidth;
  
          //set height
          elementPosition.height = element.offsetHeight;
  
          //calculate element top and left
          var _x = 0;
          var _y = 0;
          while (element && !isNaN(element.offsetLeft) && !isNaN(element.offsetTop)) {
              _x += element.offsetLeft;
              _y += element.offsetTop;
              element = element.offsetParent;
          }
          //set top
          elementPosition.top = _y;
          //set left
          elementPosition.left = _x;
      }
  
      return elementPosition;
  }
docs: Get an element position on the page
  Thanks to `meouw`: http://stackoverflow.com/a/442474/375966
  
  @api private
  @method _getOffset
  @param {Object} element
  @returns Element's position info