Home / Function/ validate_aria_attribute_value() — svelte Function Reference

validate_aria_attribute_value() — svelte Function Reference

Architecture documentation for the validate_aria_attribute_value() function in index.js from the svelte codebase.

Function javascript Compiler Transformer calls 8 called by 1

Entity Profile

Dependency Diagram

graph TD
  4a556532_b1f3_3bc7_3a43_4a663da1eb23["validate_aria_attribute_value()"]
  b389a21f_6de7_2a41_34f3_8efbf9045c9c["index.js"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|defined in| b389a21f_6de7_2a41_34f3_8efbf9045c9c
  c342967b_b314_8027_476d_d085ed0e13f0["check_element()"]
  c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 4a556532_b1f3_3bc7_3a43_4a663da1eb23
  6d8809c3_5616_e875_34fe_3cb89792e71e["a11y_incorrect_aria_attribute_type()"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|calls| 6d8809c3_5616_e875_34fe_3cb89792e71e
  ab7f109e_bcd2_aee2_15ce_24d68c0073d7["a11y_incorrect_aria_attribute_type_boolean()"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|calls| ab7f109e_bcd2_aee2_15ce_24d68c0073d7
  8a9eed50_4f1d_be43_34ec_4b4aae7d5f34["a11y_incorrect_aria_attribute_type_idlist()"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|calls| 8a9eed50_4f1d_be43_34ec_4b4aae7d5f34
  420bd6b8_8faf_b81c_ec43_f0049f5a6930["a11y_incorrect_aria_attribute_type_integer()"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|calls| 420bd6b8_8faf_b81c_ec43_f0049f5a6930
  404c79c1_4fa3_606b_225a_c4e71154bb63["a11y_incorrect_aria_attribute_type_token()"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|calls| 404c79c1_4fa3_606b_225a_c4e71154bb63
  5439801b_d67f_6bbb_bae7_1c9abc2aa128["list()"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|calls| 5439801b_d67f_6bbb_bae7_1c9abc2aa128
  d31c9357_a780_6662_eb5b_06e515769729["a11y_incorrect_aria_attribute_type_tokenlist()"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|calls| d31c9357_a780_6662_eb5b_06e515769729
  2cbbbfe3_d54f_c3ec_c408_48da1601311e["a11y_incorrect_aria_attribute_type_tristate()"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|calls| 2cbbbfe3_d54f_c3ec_c408_48da1601311e
  style 4a556532_b1f3_3bc7_3a43_4a663da1eb23 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js lines 893–965

function validate_aria_attribute_value(attribute, name, schema, value) {
	const type = schema.type;

	if (value === null) return;
	if (value === true) value = '';

	switch (type) {
		case 'id':
		case 'string': {
			if (value === '') {
				w.a11y_incorrect_aria_attribute_type(attribute, name, 'non-empty string');
			}
			break;
		}
		case 'number': {
			if (value === '' || isNaN(+value)) {
				w.a11y_incorrect_aria_attribute_type(attribute, name, 'number');
			}
			break;
		}
		case 'boolean': {
			if (value !== 'true' && value !== 'false') {
				w.a11y_incorrect_aria_attribute_type_boolean(attribute, name);
			}
			break;
		}
		case 'idlist': {
			if (value === '') {
				w.a11y_incorrect_aria_attribute_type_idlist(attribute, name);
			}
			break;
		}
		case 'integer': {
			if (value === '' || !Number.isInteger(+value)) {
				w.a11y_incorrect_aria_attribute_type_integer(attribute, name);
			}
			break;
		}
		case 'token': {
			const values = (schema.values ?? []).map((value) => value.toString());
			if (!values.includes(value.toLowerCase())) {
				w.a11y_incorrect_aria_attribute_type_token(
					attribute,
					name,
					list(values.map((v) => `"${v}"`))
				);
			}
			break;
		}
		case 'tokenlist': {
			const values = (schema.values ?? []).map((value) => value.toString());
			if (
				value
					.toLowerCase()
					.split(regex_whitespaces)
					.some((value) => !values.includes(value))
			) {
				w.a11y_incorrect_aria_attribute_type_tokenlist(
					attribute,
					name,
					list(values.map((v) => `"${v}"`))
				);
			}
			break;
		}
		case 'tristate': {
			if (value !== 'true' && value !== 'false' && value !== 'mixed') {
				w.a11y_incorrect_aria_attribute_type_tristate(attribute, name);
			}
			break;
		}
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does validate_aria_attribute_value() do?
validate_aria_attribute_value() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js.
Where is validate_aria_attribute_value() defined?
validate_aria_attribute_value() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js at line 893.
What does validate_aria_attribute_value() call?
validate_aria_attribute_value() calls 8 function(s): a11y_incorrect_aria_attribute_type, a11y_incorrect_aria_attribute_type_boolean, a11y_incorrect_aria_attribute_type_idlist, a11y_incorrect_aria_attribute_type_integer, a11y_incorrect_aria_attribute_type_token, a11y_incorrect_aria_attribute_type_tokenlist, a11y_incorrect_aria_attribute_type_tristate, list.
What calls validate_aria_attribute_value()?
validate_aria_attribute_value() is called by 1 function(s): check_element.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free