bower_components/foundation-sites/js/foundation.util.box.js
function GetDimensions(elem, test){
  elem = elem.length ? elem[0] : elem;

  if (elem === window || elem === document) {
    throw new Error("I'm sorry, Dave. I'm afraid I can't do that.");
  }

  var rect = elem.getBoundingClientRect(),
      parRect = elem.parentNode.getBoundingClientRect(),
      winRect = document.body.getBoundingClientRect(),
      winY = window.pageYOffset,
      winX = window.pageXOffset;

  return {
    width: rect.width,
    height: rect.height,
    offset: {
      top: rect.top + winY,
      left: rect.left + winX
    },
    parentDims: {
      width: parRect.width,
      height: parRect.height,
      offset: {
        top: parRect.top + winY,
        left: parRect.left + winX
      }
    },
    windowDims: {
      width: winRect.width,
      height: winRect.height,
      offset: {
        top: winY,
        left: winX
      }
    }
  }
}
function GetDimensions(elem, test){
  elem = elem.length ? elem[0] : elem;

  if (elem === window || elem === document) {
    throw new Error("I'm sorry, Dave. I'm afraid I can't do that.");
  }

  var rect = elem.getBoundingClientRect(),
      parRect = elem.parentNode.getBoundingClientRect(),
      winRect = document.body.getBoundingClientRect(),
      winY = window.pageYOffset,
      winX = window.pageXOffset;

  return {
    width: rect.width,
    height: rect.height,
    offset: {
      top: rect.top + winY,
      left: rect.left + winX
    },
    parentDims: {
      width: parRect.width,
      height: parRect.height,
      offset: {
        top: parRect.top + winY,
        left: parRect.left + winX
      }
    },
    windowDims: {
      width: winRect.width,
      height: winRect.height,
      offset: {
        top: winY,
        left: winX
      }
    }
  }
}
function GetDimensions ( elem , test ) { elem = elem . length ? elem [ 0 ] : elem ; if ( elem === window || elem === document ) { throw new Error ( "I'm sorry, Dave. I'm afraid I can't do that." ) ; } var rect = elem . getBoundingClientRect ( ) , parRect = elem . parentNode . getBoundingClientRect ( ) , winRect = document . body . getBoundingClientRect ( ) , winY = window . pageYOffset , winX = window . pageXOffset ; return { width : rect . width , height : rect . height , offset : { top : rect . top + winY , left : rect . left + winX } , parentDims : { width : parRect . width , height : parRect . height , offset : { top : parRect . top + winY , left : parRect . left + winX } } , windowDims : { width : winRect . width , height : winRect . height , offset : { top : winY , left : winX } } } }
Uses native methods to return an object of dimension values.
@function
@param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window.
@returns {Object} - nested object of integer pixel values
TODO - if element is window, return only those values.
Uses native methods to return an object of dimension values .