Sha256: ec3651de0bea4d76f0bc058daef4ec15114c13d72e136be68b6fd9c7b6c231c1
Contents?: true
Size: 1.21 KB
Versions: 375
Compression:
Stored size: 1.21 KB
Contents
/* global dom */ /** * Get the coordinates of the element passed into the function relative to the document * @method getElementCoordinates * @memberof axe.commons.dom * @instance * @param {HTMLElement} element The HTMLElement * @return {elementObj} elementObj Returns a `Object` with the following properties, which * each hold a value representing the pixels for each of the */ /** * @typedef elementObj * @type {Object} * @property {Number} top The top coordinate of the element * @property {Number} right The right coordinate of the element * @property {Number} bottom The bottom coordinate of the element * @property {Number} left The left coordinate of the element * @property {Number} width The width of the element * @property {Number} height The height of the element */ dom.getElementCoordinates = function(element) { 'use strict'; var scrollOffset = dom.getScrollOffset(document), xOffset = scrollOffset.left, yOffset = scrollOffset.top, coords = element.getBoundingClientRect(); return { top: coords.top + yOffset, right: coords.right + xOffset, bottom: coords.bottom + yOffset, left: coords.left + xOffset, width: coords.right - coords.left, height: coords.bottom - coords.top }; };
Version data entries
375 entries across 375 versions & 1 rubygems