Home / Function/ self() — svelte Function Reference

self() — svelte Function Reference

Architecture documentation for the self() function in event-modifiers.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  53354e8d_42d0_70c2_255c_9f5b50649cd7["self()"]
  10959c39_ee67_ccc9_0299_768227609d29["event-modifiers.js"]
  53354e8d_42d0_70c2_255c_9f5b50649cd7 -->|defined in| 10959c39_ee67_ccc9_0299_768227609d29
  7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c["apply()"]
  53354e8d_42d0_70c2_255c_9f5b50649cd7 -->|calls| 7a2c4b59_fc2a_bb0e_64d7_90ce67611a9c
  style 53354e8d_42d0_70c2_255c_9f5b50649cd7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/client/dom/legacy/event-modifiers.js lines 27–36

export function self(fn) {
	return function (...args) {
		var event = /** @type {Event} */ (args[0]);
		// @ts-ignore
		if (event.target === this) {
			// @ts-ignore
			fn?.apply(this, args);
		}
	};
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does self() do?
self() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/legacy/event-modifiers.js.
Where is self() defined?
self() is defined in packages/svelte/src/internal/client/dom/legacy/event-modifiers.js at line 27.
What does self() call?
self() calls 1 function(s): apply.

Analyze Your Own Codebase

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

Try Supermodel Free