Home / Function/ apply_selector() — svelte Function Reference

apply_selector() — svelte Function Reference

Architecture documentation for the apply_selector() function in css-prune.js from the svelte codebase.

Function javascript Compiler Analyzer calls 3 called by 3

Entity Profile

Dependency Diagram

graph TD
  c89a58ea_32ad_64b6_f48c_d266ac47f008["apply_selector()"]
  cb1bf043_dade_7352_cc2b_976ffa2968d8["css-prune.js"]
  c89a58ea_32ad_64b6_f48c_d266ac47f008 -->|defined in| cb1bf043_dade_7352_cc2b_976ffa2968d8
  22029545_f623_0033_1188_2848353eb5cc["prune()"]
  22029545_f623_0033_1188_2848353eb5cc -->|calls| c89a58ea_32ad_64b6_f48c_d266ac47f008
  a482078a_f217_b205_783e_29603b509866["apply_combinator()"]
  a482078a_f217_b205_783e_29603b509866 -->|calls| c89a58ea_32ad_64b6_f48c_d266ac47f008
  44fb7f7e_7a78_eedb_fde3_53e386135788["relative_selector_might_apply_to_node()"]
  44fb7f7e_7a78_eedb_fde3_53e386135788 -->|calls| c89a58ea_32ad_64b6_f48c_d266ac47f008
  44fb7f7e_7a78_eedb_fde3_53e386135788["relative_selector_might_apply_to_node()"]
  c89a58ea_32ad_64b6_f48c_d266ac47f008 -->|calls| 44fb7f7e_7a78_eedb_fde3_53e386135788
  a482078a_f217_b205_783e_29603b509866["apply_combinator()"]
  c89a58ea_32ad_64b6_f48c_d266ac47f008 -->|calls| a482078a_f217_b205_783e_29603b509866
  35596639_b906_6d9c_da50_4cb4a3a4a0b3["is_outer_global()"]
  c89a58ea_32ad_64b6_f48c_d266ac47f008 -->|calls| 35596639_b906_6d9c_da50_4cb4a3a4a0b3
  style c89a58ea_32ad_64b6_f48c_d266ac47f008 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/2-analyze/css/css-prune.js lines 195–213

function apply_selector(relative_selectors, rule, element, direction) {
	const rest_selectors = relative_selectors.slice();
	const relative_selector = direction === FORWARD ? rest_selectors.shift() : rest_selectors.pop();

	const matched =
		!!relative_selector &&
		relative_selector_might_apply_to_node(relative_selector, rule, element, direction) &&
		apply_combinator(relative_selector, rest_selectors, rule, element, direction);

	if (matched) {
		if (!is_outer_global(relative_selector)) {
			relative_selector.metadata.scoped = true;
		}

		element.metadata.scoped = true;
	}

	return matched;
}

Domain

Subdomains

Frequently Asked Questions

What does apply_selector() do?
apply_selector() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/css/css-prune.js.
Where is apply_selector() defined?
apply_selector() is defined in packages/svelte/src/compiler/phases/2-analyze/css/css-prune.js at line 195.
What does apply_selector() call?
apply_selector() calls 3 function(s): apply_combinator, is_outer_global, relative_selector_might_apply_to_node.
What calls apply_selector()?
apply_selector() is called by 3 function(s): apply_combinator, prune, relative_selector_might_apply_to_node.

Analyze Your Own Codebase

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

Try Supermodel Free