MCPcopy
hub / github.com/webpack/webpack / hasNameInScope

Function hasNameInScope

lib/html/syntax.js:4912–4922  ·  view source on GitHub ↗
(
		/** @type {string} */ tagName,
		/** @type {number} */ kind
	)

Source from the content-addressed store, hash-verified

4910 // "have an element in scope": walk the open stack from the top until the
4911 // named HTML element is found (true) or a scope boundary is hit (false).
4912 const hasNameInScope = (
4913 /** @type {string} */ tagName,
4914 /** @type {number} */ kind
4915 ) => {
4916 for (let i = open.length - 1; i >= 0; i--) {
4917 const el = open[i];
4918 if (el.namespace === NS_HTML && el.tagName === tagName) return true;
4919 if (isBoundaryForKind(el, kind)) return false;
4920 }
4921 return false;
4922 };
4923 const inScope = (/** @type {string} */ tagName) =>
4924 hasNameInScope(tagName, SCOPE_DEFAULT);
4925 const inButtonScope = (/** @type {string} */ tagName) =>

Callers 3

inScopeFunction · 0.85
inButtonScopeFunction · 0.85
inListItemScopeFunction · 0.85

Calls 1

isBoundaryForKindFunction · 0.85

Tested by

no test coverage detected