Apply suggestions from code review

pull/8299/head
Simon H 4 years ago committed by GitHub
parent f3807df59e
commit cf3e04e28a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -622,6 +622,7 @@ export default class Element extends Node {
const name_attribute = attribute_map.get('name'); const name_attribute = attribute_map.get('name');
const target_attribute = attribute_map.get('target'); const target_attribute = attribute_map.get('target');
const aria_label_attribute = attribute_map.get('aria-label'); const aria_label_attribute = attribute_map.get('aria-label');
// links with target="_blank" should have noopener or noreferrer: https://developer.chrome.com/docs/lighthouse/best-practices/external-anchors-use-rel-noopener/ // links with target="_blank" should have noopener or noreferrer: https://developer.chrome.com/docs/lighthouse/best-practices/external-anchors-use-rel-noopener/
// modern browsers add noopener by default, so we only need to check legacy browsers // modern browsers add noopener by default, so we only need to check legacy browsers
// legacy browsers don't support noopener so we only check for noreferrer there // legacy browsers don't support noopener so we only check for noreferrer there
@ -642,12 +643,14 @@ export default class Element extends Node {
} }
} }
} }
if (aria_label_attribute) { if (aria_label_attribute) {
const aria_value = aria_label_attribute.get_static_value(); const aria_value = aria_label_attribute.get_static_value();
if (aria_value != '') { if (aria_value != '') {
this.contains_a11y_label = true; this.contains_a11y_label = true;
} }
} }
if (href_attribute) { if (href_attribute) {
const href_value = href_attribute.get_static_value(); const href_value = href_attribute.get_static_value();

Loading…
Cancel
Save