MCPcopy
hub / github.com/webpack/webpack / foreignContent

Function foreignContent

lib/html/syntax.js:5276–5373  ·  lib/html/syntax.js::foreignContent
(/** @type {Token} */ t)

Source from the content-addressed store, hash-verified

5274 };
5275
5276 const foreignContent = (/** @type {Token} */ t) => {
5277 if (t.type === TOKEN_CHAR) {
5278 const data = t.data.replace(/\0/g, class="st">"�");
5279 insertCharacters(data, t.start, t.end);
5280 class="cm">// eslint-disable-next-line no-control-regex
5281 if (/[^\t\n\f\r \u0000]/.test(t.data)) framesetOk = false;
5282 return;
5283 }
5284 if (t.type === TOKEN_COMMENT) {
5285 insertComment(t.data, t.start, t.end);
5286 return;
5287 }
5288 if (t.type === TOKEN_DOCTYPE) return;
5289 if (t.type === TOKEN_START_TAG) {
5290 const acn = adjustedCurrent().namespace;
5291 if (
5292 FOREIGN_BREAKOUT.has(t.name) ||
5293 (t.name === class="st">"font" &&
5294 t.attrs.some((a) => FONT_BREAKOUT_ATTRS.has(a.name)))
5295 ) {
5296 class="cm">// parse error; pop until integration point / html / mathml-text-integration
5297 while (open.length > 1) {
5298 const c = cur();
5299 if (
5300 c.namespace === NS_HTML ||
5301 mathmlTextIntegrationPoint(c) ||
5302 htmlIntegrationPoint(c)
5303 ) {
5304 break;
5305 }
5306 open.pop();
5307 }
5308 runMode(t);
5309 return;
5310 }
5311 const ns = acn;
5312 let name = t.name;
5313 let attrs = t.attrs;
5314 if (ns === NS_SVG) {
5315 name = adjustSvgTag(name);
5316 }
5317 if (ns === NS_MATHML) {
5318 attrs = adjustMathmlAttrs(attrs);
5319 }
5320 attrs = adjustForeignAttrs(attrs, ns);
5321 insertForeignElement(name, ns, attrs, t.pos);
5322 if (t.selfClosing) {
5323 open.pop();
5324 }
5325 return;
5326 }
5327 if (t.type === TOKEN_END_TAG) {
5328 if (
5329 t.name === class="st">"script" &&
5330 cur().tagName === class="st">"script" &&
5331 cur().namespace === NS_SVG
5332 ) {
5333 open.pop();

Callers 1

processFunction · 0.85

Calls 15

insertCharactersFunction · 0.85
insertCommentFunction · 0.85
adjustedCurrentFunction · 0.85
curFunction · 0.85
htmlIntegrationPointFunction · 0.85
runModeFunction · 0.85
adjustSvgTagFunction · 0.85
adjustMathmlAttrsFunction · 0.85
adjustForeignAttrsFunction · 0.85
insertForeignElementFunction · 0.85
popMethod · 0.80

Tested by

no test coverage detected