check_element() — svelte Function Reference
Architecture documentation for the check_element() function in index.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD c342967b_b314_8027_476d_d085ed0e13f0["check_element()"] b389a21f_6de7_2a41_34f3_8efbf9045c9c["index.js"] c342967b_b314_8027_476d_d085ed0e13f0 -->|defined in| b389a21f_6de7_2a41_34f3_8efbf9045c9c 874d992f_5e60_ebce_f4ce_ea5fed014bc4["RegularElement()"] 874d992f_5e60_ebce_f4ce_ea5fed014bc4 -->|calls| c342967b_b314_8027_476d_d085ed0e13f0 33910f4c_6ec4_15d9_8342_5265e706975f["SvelteElement()"] 33910f4c_6ec4_15d9_8342_5265e706975f -->|calls| c342967b_b314_8027_476d_d085ed0e13f0 e9a2c29e_d0ca_ab9f_b86f_f22ff802db91["is_event_attribute()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| e9a2c29e_d0ca_ab9f_b86f_f22ff802db91 e9e928cd_ecf3_b386_9b42_407f2fa12962["add()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| e9e928cd_ecf3_b386_9b42_407f2fa12962 d74f6e21_de3c_dbc0_f6e6_a119f708c4c8["is_content_editable_binding()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| d74f6e21_de3c_dbc0_f6e6_a119f708c4c8 d9e10c1a_4b53_ad4a_3649_d80ac30e90e9["a11y_aria_attributes()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| d9e10c1a_4b53_ad4a_3649_d80ac30e90e9 0913e53f_3cfc_070a_7b42_568cf6860af3["fuzzymatch()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 0913e53f_3cfc_070a_7b42_568cf6860af3 0b60e58e_a92e_d171_f0ee_7f2bcdde32e3["a11y_unknown_aria_attribute()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 0b60e58e_a92e_d171_f0ee_7f2bcdde32e3 82706567_cf93_db4d_dcf0_4f956162c9e6["a11y_hidden()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 82706567_cf93_db4d_dcf0_4f956162c9e6 17dd7346_e043_e143_0605_8c529acf45a0["get_static_value()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 17dd7346_e043_e143_0605_8c529acf45a0 82c454e1_d40e_f288_e9f9_3476ef8e8419["get()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 82c454e1_d40e_f288_e9f9_3476ef8e8419 4a556532_b1f3_3bc7_3a43_4a663da1eb23["validate_aria_attribute_value()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 4a556532_b1f3_3bc7_3a43_4a663da1eb23 5acfd1c3_3276_87e5_e11b_ba9dfa9d12fc["is_interactive_element()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 5acfd1c3_3276_87e5_e11b_ba9dfa9d12fc style c342967b_b314_8027_476d_d085ed0e13f0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js lines 56–563
export function check_element(node, context) {
/** @type {Map<string, AST.Attribute>} */
const attribute_map = new Map();
/** @type {Set<string>} */
const handlers = new Set();
/** @type {AST.Attribute[]} */
const attributes = [];
const is_dynamic_element = node.type === 'SvelteElement';
let has_spread = false;
let has_contenteditable_attr = false;
let has_contenteditable_binding = false;
for (const attribute of node.attributes) {
switch (attribute.type) {
case 'Attribute': {
if (is_event_attribute(attribute)) {
handlers.add(attribute.name.slice(2));
} else {
attributes.push(attribute);
attribute_map.set(attribute.name, attribute);
if (attribute.name === 'contenteditable') {
has_contenteditable_attr = true;
}
}
break;
}
case 'SpreadAttribute': {
has_spread = true;
break;
}
case 'BindDirective': {
if (is_content_editable_binding(attribute.name)) {
has_contenteditable_binding = true;
}
break;
}
case 'OnDirective': {
handlers.add(attribute.name);
break;
}
}
}
for (const attribute of node.attributes) {
if (attribute.type !== 'Attribute') continue;
const name = attribute.name.toLowerCase();
// aria-props
if (name.startsWith('aria-')) {
if (invisible_elements.includes(node.name)) {
// aria-unsupported-elements
w.a11y_aria_attributes(attribute, node.name);
}
const type = name.slice(5);
if (!aria_attributes.includes(type)) {
const match = fuzzymatch(type, aria_attributes);
w.a11y_unknown_aria_attribute(attribute, type, match);
}
if (name === 'aria-hidden' && regex_heading_tags.test(node.name)) {
w.a11y_hidden(attribute, node.name);
}
// aria-proptypes
let value = get_static_value(attribute);
const schema = aria.get(/** @type {ARIAProperty} */ (name));
if (schema !== undefined) {
validate_aria_attribute_value(attribute, /** @type {ARIAProperty} */ (name), schema, value);
}
// aria-activedescendant-has-tabindex
if (
name === 'aria-activedescendant' &&
!is_dynamic_element &&
!is_interactive_element(node.name, attribute_map) &&
Domain
Subdomains
Calls
- a11y_accesskey()
- a11y_aria_activedescendant_has_tabindex()
- a11y_aria_attributes()
- a11y_autocomplete_valid()
- a11y_autofocus()
- a11y_click_events_have_key_events()
- a11y_consider_explicit_label()
- a11y_distracting_elements()
- a11y_figcaption_index()
- a11y_figcaption_parent()
- a11y_hidden()
- a11y_img_redundant_alt()
- a11y_interactive_supports_focus()
- a11y_invalid_attribute()
- a11y_label_has_associated_control()
- a11y_media_has_caption()
- a11y_misplaced_role()
- a11y_misplaced_scope()
- a11y_missing_content()
- a11y_mouse_events_have_key_events()
- a11y_no_abstract_role()
- a11y_no_interactive_element_to_noninteractive_role()
- a11y_no_noninteractive_element_interactions()
- a11y_no_noninteractive_element_to_interactive_role()
- a11y_no_noninteractive_tabindex()
- a11y_no_redundant_roles()
- a11y_no_static_element_interactions()
- a11y_positive_tabindex()
- a11y_role_has_required_aria_props()
- a11y_role_supports_aria_props()
- a11y_role_supports_aria_props_implicit()
- a11y_unknown_aria_attribute()
- a11y_unknown_role()
- add()
- fuzzymatch()
- get()
- get_implicit_role()
- get_static_text_value()
- get_static_value()
- has_content()
- has_disabled_attribute()
- is_abstract_role()
- is_content_editable_binding()
- is_event_attribute()
- is_hidden_from_screen_reader()
- is_interactive_element()
- is_interactive_roles()
- is_non_interactive_element()
- is_non_interactive_roles()
- is_parent()
- is_presentation_role()
- is_semantic_role_element()
- is_static_element()
- is_valid_autocomplete()
- list()
- validate_aria_attribute_value()
- warn_missing_attribute()
Called By
Source
Frequently Asked Questions
What does check_element() do?
check_element() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js.
Where is check_element() defined?
check_element() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js at line 56.
What does check_element() call?
check_element() calls 57 function(s): a11y_accesskey, a11y_aria_activedescendant_has_tabindex, a11y_aria_attributes, a11y_autocomplete_valid, a11y_autofocus, a11y_click_events_have_key_events, a11y_consider_explicit_label, a11y_distracting_elements, and 49 more.
What calls check_element()?
check_element() is called by 2 function(s): RegularElement, SvelteElement.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free