Sha256: 54c507172721a649808c3dcf24af8d5a7dbe7adf44fee4b3f657ff86e9475e80

Contents?: true

Size: 906 Bytes

Versions: 104

Compression:

Stored size: 906 Bytes

Contents

/*global dom */
/*eslint complexity: ["error",20] */

const visualRoles = [
	'checkbox',
	'img',
	'radio',
	'range',
	'slider',
	'spinbutton',
	'textbox'
];

/**
 * Check if an element is an inherently visual element
 * @method isVisualContent
 * @memberof axe.commons.dom
 * @instance
 * @param  {Element} element The element to check
 * @return {Boolean}
 */
dom.isVisualContent = function(element) {
	/*eslint indent: 0*/
	const role = element.getAttribute('role');
	if (role) {
		return visualRoles.indexOf(role) !== -1;
	}

	switch (element.nodeName.toUpperCase()) {
		case 'IMG':
		case 'IFRAME':
		case 'OBJECT':
		case 'VIDEO':
		case 'AUDIO':
		case 'CANVAS':
		case 'SVG':
		case 'MATH':
		case 'BUTTON':
		case 'SELECT':
		case 'TEXTAREA':
		case 'KEYGEN':
		case 'PROGRESS':
		case 'METER':
			return true;
		case 'INPUT':
			return element.type !== 'hidden';
		default:
			return false;
	}
};

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
govuk_publishing_components-21.16.3 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.16.2 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.16.1 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.16.0 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.15.2 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.15.1 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.15.0 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.14.0 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.13.5 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.13.4 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.13.3 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.13.2 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.13.1 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.13.0 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.12.0 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.11.0 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.10.0 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.9.0 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.8.1 node_modules/axe-core/lib/commons/dom/is-visual-content.js
govuk_publishing_components-21.8.0 node_modules/axe-core/lib/commons/dom/is-visual-content.js