decode_character_references() — svelte Function Reference
Architecture documentation for the decode_character_references() function in html.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 83712aa1_c83d_1cd5_c47d_1cdb04dd210c["decode_character_references()"] 06660fad_daa2_c824_01c8_ebafc63758a1["html.js"] 83712aa1_c83d_1cd5_c47d_1cdb04dd210c -->|defined in| 06660fad_daa2_c824_01c8_ebafc63758a1 dc598a1a_5625_fb76_e8ae_097c399278e6["read_static_attribute()"] dc598a1a_5625_fb76_e8ae_097c399278e6 -->|calls| 83712aa1_c83d_1cd5_c47d_1cdb04dd210c babf57bd_0606_e8ec_fde4_75ed47bb1407["read_sequence()"] babf57bd_0606_e8ec_fde4_75ed47bb1407 -->|calls| 83712aa1_c83d_1cd5_c47d_1cdb04dd210c 336f9996_ecb1_725a_1c20_d9de54fd73b9["text()"] 336f9996_ecb1_725a_1c20_d9de54fd73b9 -->|calls| 83712aa1_c83d_1cd5_c47d_1cdb04dd210c 6109b795_2fdc_5107_388c_1e07cbee6bac["validate_code()"] 83712aa1_c83d_1cd5_c47d_1cdb04dd210c -->|calls| 6109b795_2fdc_5107_388c_1e07cbee6bac style 83712aa1_c83d_1cd5_c47d_1cdb04dd210c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/1-parse/utils/html.js lines 40–66
export function decode_character_references(html, is_attribute_value) {
const entity_pattern = is_attribute_value ? entity_pattern_attr_value : entity_pattern_content;
return html.replace(
entity_pattern,
/**
* @param {any} match
* @param {keyof typeof entities} entity
*/ (match, entity) => {
let code;
// Handle named entities
if (entity[0] !== '#') {
code = entities[entity];
} else if (entity[1] === 'x') {
code = parseInt(entity.substring(2), 16);
} else {
code = parseInt(entity.substring(1), 10);
}
if (!code) {
return match;
}
return String.fromCodePoint(validate_code(code));
}
);
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does decode_character_references() do?
decode_character_references() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/1-parse/utils/html.js.
Where is decode_character_references() defined?
decode_character_references() is defined in packages/svelte/src/compiler/phases/1-parse/utils/html.js at line 40.
What does decode_character_references() call?
decode_character_references() calls 1 function(s): validate_code.
What calls decode_character_references()?
decode_character_references() is called by 3 function(s): read_sequence, read_static_attribute, text.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free