lib/core/utils/get-selector.js
function getAttributeNameValue(node, at) {
	const name = at.name;
	let atnv;

	if (name.indexOf('href') !== -1 || name.indexOf('src') !== -1) {
		let friendly = axe.utils.getFriendlyUriEnd(node.getAttribute(name));
		if (friendly) {
			let value = encodeURI(friendly);
			if (value) {
				atnv = escapeSelector(at.name) + '$="' + escapeSelector(value) + '"';
			} else {
				return;
			}
		} else {
			atnv =
				escapeSelector(at.name) +
				'="' +
				escapeSelector(node.getAttribute(name)) +
				'"';
		}
	} else {
		atnv = escapeSelector(name) + '="' + escapeSelector(at.value) + '"';
	}
	return atnv;
}
function getAttributeNameValue(node, at) {
	const name = at.name;
	let atnv;

	if (name.indexOf('href') !== -1 || name.indexOf('src') !== -1) {
		let friendly = axe.utils.getFriendlyUriEnd(node.getAttribute(name));
		if (friendly) {
			let value = encodeURI(friendly);
			if (value) {
				atnv = escapeSelector(at.name) + '$="' + escapeSelector(value) + '"';
			} else {
				return;
			}
		} else {
			atnv =
				escapeSelector(at.name) +
				'="' +
				escapeSelector(node.getAttribute(name)) +
				'"';
		}
	} else {
		atnv = escapeSelector(name) + '="' + escapeSelector(at.value) + '"';
	}
	return atnv;
}
function getAttributeNameValue ( node , at ) { const name = at . name ; let atnv ; if ( name . indexOf ( 'href' ) !== - 1 || name . indexOf ( 'src' ) !== - 1 ) { let friendly = axe . utils . getFriendlyUriEnd ( node . getAttribute ( name ) ) ; if ( friendly ) { let value = encodeURI ( friendly ) ; if ( value ) { atnv = escapeSelector ( at . name ) + '$="' + escapeSelector ( value ) + '"' ; } else { return ; } } else { atnv = escapeSelector ( at . name ) + '="' + escapeSelector ( node . getAttribute ( name ) ) + '"' ; } } else { atnv = escapeSelector ( name ) + '="' + escapeSelector ( at . value ) + '"' ; } return atnv ; }
get the attribute name and value as a string
@param {Element} node		The element that has the attribute
@param {Attribute} at		The attribute
@return {String}
get the attribute name and value as a string