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-21.16.3 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.16.2 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.16.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.16.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.15.2 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.15.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.15.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.14.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.13.5 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.13.4 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.13.3 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.13.2 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.13.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.13.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.12.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.11.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.10.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.9.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.8.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-21.8.0 node_modules/axe-core/lib/commons/table/get-cell-position.js