Sha256: b2311fa6305423468c5bd9cdc6b8c56bc54db8573bb73c12a2b7c0c5ccb3e652

Contents?: true

Size: 696 Bytes

Versions: 104

Compression:

Stored size: 696 Bytes

Contents

options = options || {};

var invalid = [];

var attr,
	attrName,
	allowed,
	role = node.getAttribute('role'),
	attrs = node.attributes;

if (!role) {
	role = axe.commons.aria.implicitRole(node);
}

allowed = axe.commons.aria.allowedAttr(role);

if (Array.isArray(options[role])) {
	allowed = axe.utils.uniqueArray(options[role].concat(allowed));
}

if (role && allowed) {
	for (var i = 0, l = attrs.length; i < l; i++) {
		attr = attrs[i];
		attrName = attr.name;
		if (
			axe.commons.aria.validateAttr(attrName) &&
			!allowed.includes(attrName)
		) {
			invalid.push(attrName + '="' + attr.nodeValue + '"');
		}
	}
}

if (invalid.length) {
	this.data(invalid);
	return false;
}

return true;

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
govuk_publishing_components-21.16.3 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.16.2 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.16.1 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.16.0 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.15.2 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.15.1 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.15.0 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.14.0 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.13.5 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.13.4 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.13.3 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.13.2 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.13.1 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.13.0 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.12.0 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.11.0 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.10.0 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.9.0 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.8.1 node_modules/axe-core/lib/checks/aria/allowed-attr.js
govuk_publishing_components-21.8.0 node_modules/axe-core/lib/checks/aria/allowed-attr.js