Sha256: 8a92aa459eada7d39505fbd8b50f54549e0cd77c426696924985dfe6fd43a72f

Contents?: true

Size: 876 Bytes

Versions: 104

Compression:

Stored size: 876 Bytes

Contents

/* global table */

/**
 * Get any associated table headers for a `HTMLTableCellElement`
 * @method getHeaders
 * @memberof axe.commons.table
 * @instance
 * @param  {HTMLTableCellElement} cell The cell of which to get headers
 * @return {Array<HTMLTableCellElement>} Array of headers associated to the table cell
 */
table.getHeaders = function(cell) {
	if (cell.hasAttribute('headers')) {
		return commons.dom.idrefs(cell, 'headers');
	}

	var tableGrid = commons.table.toGrid(commons.dom.findUp(cell, 'table'));
	var position = commons.table.getCellPosition(cell, tableGrid);

	// TODO: RTL text
	var rowHeaders = table
		.traverse('left', position, tableGrid)
		.filter(cell => table.isRowHeader(cell));

	var colHeaders = table
		.traverse('up', position, tableGrid)
		.filter(cell => table.isColumnHeader(cell));

	return [].concat(rowHeaders, colHeaders).reverse();
};

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