|
|
@ -6,7 +6,9 @@ import { roles as roles_map, aria, elementRoles } from 'aria-query';
|
|
|
|
import { AXObjects, AXObjectRoles, elementAXObjects } from 'axobject-query';
|
|
|
|
import { AXObjects, AXObjectRoles, elementAXObjects } from 'axobject-query';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
regex_heading_tags,
|
|
|
|
regex_heading_tags,
|
|
|
|
|
|
|
|
regex_js_prefix,
|
|
|
|
regex_not_whitespace,
|
|
|
|
regex_not_whitespace,
|
|
|
|
|
|
|
|
regex_redundant_img_alt,
|
|
|
|
regex_starts_with_vowel,
|
|
|
|
regex_starts_with_vowel,
|
|
|
|
regex_whitespaces
|
|
|
|
regex_whitespaces
|
|
|
|
} from '../../../patterns.js';
|
|
|
|
} from '../../../patterns.js';
|
|
|
@ -1011,7 +1013,7 @@ export function check_element(node, context) {
|
|
|
|
if (href) {
|
|
|
|
if (href) {
|
|
|
|
const href_value = get_static_text_value(href);
|
|
|
|
const href_value = get_static_text_value(href);
|
|
|
|
if (href_value !== null) {
|
|
|
|
if (href_value !== null) {
|
|
|
|
if (href_value === '' || href_value === '#' || /^\W*javascript:/i.test(href_value)) {
|
|
|
|
if (href_value === '' || href_value === '#' || regex_js_prefix.test(href_value)) {
|
|
|
|
w.a11y_invalid_attribute(href, href_value, href.name);
|
|
|
|
w.a11y_invalid_attribute(href, href_value, href.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1061,7 +1063,7 @@ export function check_element(node, context) {
|
|
|
|
const alt_attribute = get_static_text_value(attribute_map.get('alt'));
|
|
|
|
const alt_attribute = get_static_text_value(attribute_map.get('alt'));
|
|
|
|
const aria_hidden = get_static_value(attribute_map.get('aria-hidden'));
|
|
|
|
const aria_hidden = get_static_value(attribute_map.get('aria-hidden'));
|
|
|
|
if (alt_attribute && !aria_hidden && !has_spread) {
|
|
|
|
if (alt_attribute && !aria_hidden && !has_spread) {
|
|
|
|
if (/\b(image|picture|photo)\b/i.test(alt_attribute)) {
|
|
|
|
if (regex_redundant_img_alt.test(alt_attribute)) {
|
|
|
|
w.a11y_img_redundant_alt(node);
|
|
|
|
w.a11y_img_redundant_alt(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|