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-17.12.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.11.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.10.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.9.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.8.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.7.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.6.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.6.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.5.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.4.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.3.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.2.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.1.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.1.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-17.0.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-16.29.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-16.28.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-16.27.1 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-16.27.0 node_modules/axe-core/lib/commons/table/get-cell-position.js
govuk_publishing_components-16.26.0 node_modules/axe-core/lib/commons/table/get-cell-position.js