MCPcopy
hub / github.com/webpack/webpack / mkEl

Function mkEl

lib/html/syntax.js:4660–4680  ·  view source on GitHub ↗
(
		/** @type {string} */ tagName,
		/** @type {number} */ ns,
		/** @type {HtmlAttribute[] | undefined} */ attributes,
		/** @type {TagPos | null | undefined} */ pos
	)

Source from the content-addressed store, hash-verified

4658 };
4659
4660 const mkEl = (
4661 /** @type {string} */ tagName,
4662 /** @type {number} */ ns,
4663 /** @type {HtmlAttribute[] | undefined} */ attributes,
4664 /** @type {TagPos | null | undefined} */ pos
4665 ) =>
4666 /** @type {HtmlElement} */ ({
4667 type: NodeType.Element,
4668 tagName,
4669 namespace: ns,
4670 attributes: attributes || EMPTY_ATTRS,
4671 children: [],
4672 selfClosing: ns === NS_HTML && VOID.has(tagName),
4673 start: pos ? pos.start : 0,
4674 end: pos ? pos.end : 0,
4675 tagEnd: pos ? pos.tagEnd : 0,
4676 nameEnd: pos ? pos.nameEnd : 0,
4677 // Present from creation (only `<template>` fills it) so every element
4678 // keeps one monomorphic hidden class for the open-stack/scope loops.
4679 templateContent: undefined
4680 });
4681
4682 // Clone of a formatting element's attributes: keep name/value (and the
4683 // serializer name) but drop source offsets so the consumer doesn't emit a

Callers 5

insertHtmlElementFunction · 0.85
insertForeignElementFunction · 0.85
reconstructAfeFunction · 0.85
adoptionAgencyFunction · 0.85
buildHtmlAstFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected