RegularElement.js — svelte Source File
Architecture documentation for RegularElement.js, a javascript file in the svelte codebase. 22 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 60af7ccf_2ceb_e5af_2432_c5b753a12c2a["RegularElement.js"] 2aa63f4e_82c9_33e3_ac6c_5f3d46250522["utils.js"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> 2aa63f4e_82c9_33e3_ac6c_5f3d46250522 ded343d4_9f64_40db_2c3d_049cfb2ee86e["is_mathml"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> ded343d4_9f64_40db_2c3d_049cfb2ee86e a7190cf9_11f3_7b29_6ed5_5ee01fc100af["is_svg"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> a7190cf9_11f3_7b29_6ed5_5ee01fc100af 02a8b5a2_13c5_e5b3_1ed2_617763d0904d["is_void"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> 02a8b5a2_13c5_e5b3_1ed2_617763d0904d 302f84f3_ec7c_fd57_5b8e_e2f3ec2953b7["html-tree-validation.js"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> 302f84f3_ec7c_fd57_5b8e_e2f3ec2953b7 f7866d2b_dae9_12da_76a2_8cd373b8b5db["is_tag_valid_with_ancestor"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> f7866d2b_dae9_12da_76a2_8cd373b8b5db b52e7925_73b5_1187_beab_fb7eb59cc45d["is_tag_valid_with_parent"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> b52e7925_73b5_1187_beab_fb7eb59cc45d 495501a4_a342_6a4d_ac11_e3e2fee8b218["errors.js"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> 495501a4_a342_6a4d_ac11_e3e2fee8b218 a146f6ac_0088_8736_b6ce_318f9f115170["e"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> a146f6ac_0088_8736_b6ce_318f9f115170 56a689f9_11c0_cc76_bd60_41bb6dc96475["warnings.js"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> 56a689f9_11c0_cc76_bd60_41bb6dc96475 3246e0bc_b9fc_f638_5e35_41e8c39a2408["w"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> 3246e0bc_b9fc_f638_5e35_41e8c39a2408 bbca3d2a_42c8_b215_d3b5_5077ccaf0797["nodes.js"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> bbca3d2a_42c8_b215_d3b5_5077ccaf0797 53888034_73fb_39d8_be82_b1928817ff74["create_attribute"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> 53888034_73fb_39d8_be82_b1928817ff74 76437ce7_73fa_a7f2_397a_1ddd381e8282["is_custom_element_node"] 60af7ccf_2ceb_e5af_2432_c5b753a12c2a --> 76437ce7_73fa_a7f2_397a_1ddd381e8282 style 60af7ccf_2ceb_e5af_2432_c5b753a12c2a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/** @import { AST } from '#compiler' */
/** @import { Context } from '../types' */
import { is_mathml, is_svg, is_void } from '../../../../utils.js';
import {
is_tag_valid_with_ancestor,
is_tag_valid_with_parent
} from '../../../../html-tree-validation.js';
import * as e from '../../../errors.js';
import * as w from '../../../warnings.js';
import {
create_attribute,
is_custom_element_node,
is_customizable_select_element
} from '../../nodes.js';
import { regex_starts_with_newline } from '../../patterns.js';
import { check_element } from './shared/a11y/index.js';
import { validate_element } from './shared/element.js';
import { mark_subtree_dynamic } from './shared/fragment.js';
/**
* @param {AST.RegularElement} node
* @param {Context} context
*/
export function RegularElement(node, context) {
validate_element(node, context);
check_element(node, context);
node.metadata.path = [...context.path];
context.state.analysis.elements.push(node);
// Special case: Move the children of <textarea> into a value attribute if they are dynamic
if (node.name === 'textarea' && node.fragment.nodes.length > 0) {
for (const attribute of node.attributes) {
if (attribute.type === 'Attribute' && attribute.name === 'value') {
e.textarea_invalid_content(node);
}
}
if (node.fragment.nodes.length > 1 || node.fragment.nodes[0].type !== 'Text') {
const first = node.fragment.nodes[0];
if (first.type === 'Text') {
// The leading newline character needs to be stripped because of a qirk:
// It is ignored by browsers if the tag and its contents are set through
// innerHTML, but we're now setting it through the value property at which
// point it is _not_ ignored, so we need to strip it ourselves.
// see https://html.spec.whatwg.org/multipage/syntax.html#element-restrictions
// see https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
first.data = first.data.replace(regex_starts_with_newline, '');
first.raw = first.raw.replace(regex_starts_with_newline, '');
}
node.attributes.push(
create_attribute(
'value',
null,
-1,
-1,
// @ts-ignore
node.fragment.nodes
)
// ... (151 more lines)
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does RegularElement.js do?
RegularElement.js is a source file in the svelte codebase, written in javascript. It belongs to the Compiler domain, Transformer subdomain.
What functions are defined in RegularElement.js?
RegularElement.js defines 1 function(s): RegularElement.
What does RegularElement.js depend on?
RegularElement.js imports 22 module(s): check_element, create_attribute, e, element.js, errors.js, fragment.js, html-tree-validation.js, index.js, and 14 more.
What files import RegularElement.js?
RegularElement.js is imported by 1 file(s): index.js.
Where is RegularElement.js in the architecture?
RegularElement.js is located at packages/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/2-analyze/visitors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free