Sha256: 25e9d7368418cb2e673a6e3e68eec2a149f84159d6edb356791502f71c4dcea7

Contents?: true

Size: 721 Bytes

Versions: 104

Compression:

Stored size: 721 Bytes

Contents

/* global table, dom */

/**
 * Get the x, y coordinates of a table cell; normalized for rowspan and colspan
 * @method getCellPosition
 * @memberof axe.commons.table
 * @instance
 * @param  {HTMLTableCellElement} cell The table cell of which to get the position
 * @return {Object} Object with `x` and `y` properties of the coordinates
 */
table.getCellPosition = function(cell, tableGrid) {
	var rowIndex, index;
	if (!tableGrid) {
		tableGrid = table.toGrid(dom.findUp(cell, 'table'));
	}

	for (rowIndex = 0; rowIndex < tableGrid.length; rowIndex++) {
		if (tableGrid[rowIndex]) {
			index = tableGrid[rowIndex].indexOf(cell);
			if (index !== -1) {
				return {
					x: index,
					y: rowIndex
				};
			}
		}
	}
};

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
govuk_publishing_components-20.0.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-19.0.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-18.3.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-18.3.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-18.2.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-18.1.2 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-18.1.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-18.0.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.21.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.20.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.19.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.19.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.18.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.17.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.16.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.15.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.14.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.13.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.12.2 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.12.1 node_modules/axe-core/lib/commons/table/get-cell-position.js