Home / File/ RegularElement.js — svelte Source File

RegularElement.js — svelte Source File

Architecture documentation for RegularElement.js, a javascript file in the svelte codebase. 41 imports, 2 dependents.

File javascript Compiler Transformer 41 imports 2 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  4610488f_3cf2_5f73_043e_da0aa9d026fe["RegularElement.js"]
  2aa63f4e_82c9_33e3_ac6c_5f3d46250522["utils.js"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 2aa63f4e_82c9_33e3_ac6c_5f3d46250522
  236530b5_f75d_4a7b_e916_b2d6a6d54dfb["cannot_be_set_statically"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 236530b5_f75d_4a7b_e916_b2d6a6d54dfb
  db3fdf7c_1bf2_5a09_e360_135ad90dbca3["is_boolean_attribute"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> db3fdf7c_1bf2_5a09_e360_135ad90dbca3
  b483c37e_f423_950d_2699_2e4d88135b0d["is_dom_property"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> b483c37e_f423_950d_2699_2e4d88135b0d
  92af2a3e_97f5_d3f7_30f9_40cc10f923d0["is_load_error_element"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 92af2a3e_97f5_d3f7_30f9_40cc10f923d0
  62f818c8_e890_17ed_5ec1_92f953d4a7a6["state.js"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 62f818c8_e890_17ed_5ec1_92f953d4a7a6
  7a7783f8_ffa6_0cc3_61b0_031882649535["is_ignored"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 7a7783f8_ffa6_0cc3_61b0_031882649535
  0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c["ast.js"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 0c5c28a7_226d_4e7c_e75e_0853c0a9fc2c
  e9a2c29e_d0ca_ab9f_b86f_f22ff802db91["is_event_attribute"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> e9a2c29e_d0ca_ab9f_b86f_f22ff802db91
  653284b2_68fd_eee3_0064_918a4c065d4a["is_text_attribute"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 653284b2_68fd_eee3_0064_918a4c065d4a
  bbca3d2a_42c8_b215_d3b5_5077ccaf0797["nodes.js"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> bbca3d2a_42c8_b215_d3b5_5077ccaf0797
  53888034_73fb_39d8_be82_b1928817ff74["create_attribute"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 53888034_73fb_39d8_be82_b1928817ff74
  6e00a8f3_2371_ecf1_5a93_296f787aca83["ExpressionMetadata"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 6e00a8f3_2371_ecf1_5a93_296f787aca83
  76437ce7_73fa_a7f2_397a_1ddd381e8282["is_custom_element_node"]
  4610488f_3cf2_5f73_043e_da0aa9d026fe --> 76437ce7_73fa_a7f2_397a_1ddd381e8282
  style 4610488f_3cf2_5f73_043e_da0aa9d026fe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @import { ArrayExpression, Expression, ExpressionStatement, Identifier, MemberExpression, ObjectExpression } from 'estree' */
/** @import { AST } from '#compiler' */
/** @import { ComponentClientTransformState, ComponentContext } from '../types' */
/** @import { Scope } from '../../../scope' */
import {
	cannot_be_set_statically,
	is_boolean_attribute,
	is_dom_property,
	is_load_error_element
} from '../../../../../utils.js';
import { is_ignored } from '../../../../state.js';
import { is_event_attribute, is_text_attribute } from '../../../../utils/ast.js';
import * as b from '#compiler/builders';
import {
	create_attribute,
	ExpressionMetadata,
	is_custom_element_node,
	is_customizable_select_element
} from '../../../nodes.js';
import { clean_nodes, determine_namespace_for_children } from '../../utils.js';
import { build_getter } from '../utils.js';
import {
	get_attribute_name,
	build_attribute_value,
	build_attribute_effect,
	build_set_class,
	build_set_style
} from './shared/element.js';
import { process_children, is_static_element } from './shared/fragment.js';
import { build_render_statement, build_template_chunk, Memoizer } from './shared/utils.js';
import { visit_event_attribute } from './shared/events.js';
import { Template } from '../transform-template/template.js';
import { transform_template } from '../transform-template/index.js';
import { TEMPLATE_FRAGMENT } from '../../../../../constants.js';

/**
 * @param {AST.RegularElement} node
 * @param {ComponentContext} context
 */
export function RegularElement(node, context) {
	context.state.template.push_element(node.name, node.start);

	if (node.name === 'noscript') {
		context.state.template.pop_element();
		return;
	}

	const is_custom_element = is_custom_element_node(node);

	// cloneNode is faster, but it does not instantiate the underlying class of the
	// custom element until the template is connected to the dom, which would
	// cause problems when setting properties on the custom element.
	// Therefore we need to use importNode instead, which doesn't have this caveat.
	// Additionally, Webkit browsers need importNode for video elements for autoplay
	// to work correctly.
	context.state.template.needs_import_node ||= node.name === 'video' || is_custom_element;

	context.state.template.contains_script_tag ||= node.name === 'script';

	/** @type {Array<AST.Attribute | AST.SpreadAttribute>} */
// ... (729 more lines)

Domain

Subdomains

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 7 function(s): RegularElement, build_class_directives_object, build_custom_element_attribute_update_assignment, build_element_attribute_update, build_element_special_value_attribute, build_style_directives_object, setup_select_synchronization.
What does RegularElement.js depend on?
RegularElement.js imports 41 module(s): ExpressionMetadata, Memoizer, Template, ast.js, build_attribute_effect, build_attribute_value, build_getter, build_render_statement, and 33 more.
What files import RegularElement.js?
RegularElement.js is imported by 2 file(s): element.js, transform-client.js.
Where is RegularElement.js in the architecture?
RegularElement.js is located at packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js (domain: Compiler, subdomain: Transformer, directory: packages/svelte/src/compiler/phases/3-transform/client/visitors).

Analyze Your Own Codebase

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

Try Supermodel Free