def image_alt(file, target_alt): root = CheckNode(None) build_tree(root, file.tree) src = file.source.lower() if r"<img" in src: return find_valid(root, file, target_alt) return []
def no_autofocus(file, target_alt): root = CheckNode(None) build_tree(root, file.tree) src = file.source.lower() if r"autofocus" in src: return find_valid(root, file, target_alt) return []
def meta_viewport(file, config): root = CheckNode(None) build_tree(root, file.tree) src = file.source.lower() if r"user-scalable" in src or r"maximum-scale" in src: return find_valid(root, file) return []
def aria_role(file, target_roles): root = CheckNode(None) build_tree(root, file.tree) src = file.source.lower() if r" role" in src: return find_role_errors(root, file, target_roles) return []
def tabindex_no_positive(file, config): root = CheckNode(None) build_tree(root, file.tree) src = file.source.lower() if r"tabindex" in src: return find_valid(root, file) return []
def html_has_lang(file, target_lang): root = CheckNode(None) build_tree(root, file.tree) src = file.source.lower() target = (target_lang if isinstance(target_lang, (tuple, list)) else (target_lang, )) if r"<html" in src: return find_valid(root, file, target) return []
def django_forms_rendering(file, target): root = CheckNode(None) build_tree(root, file.tree) src = file.source.lower() if r".as_table" in src or ".as_ul" in src or ".as_p" in src: disallowed_variants = ( ["as_table", "as_ul"] if target == "as_p" else ["as_table", "as_ul", "as_p"] ) return find_valid(root, file, disallowed_variants) return []