MCPcopy
hub / github.com/webpack/webpack / emitAttribute

Function emitAttribute

lib/html/syntax.js:522–544  ·  view source on GitHub ↗
(endPos)

Source from the content-addressed store, hash-verified

520 * @returns {number} next position
521 */
522 const emitAttribute = (endPos) => {
523 // Default `nextPos` advances past the closing quote (if any) so the
524 // state machine can continue when no `attribute` callback is provided.
525 // When a callback IS provided, its return value overrides the default —
526 // the callback is expected to do the same advance based on the
527 // reported `quoteType`.
528 let nextPos = attrQuoteType === QUOTE_NONE ? endPos : endPos + 1;
529 if (callbacks.attribute !== undefined && attrNameStart !== -1) {
530 nextPos = callbacks.attribute(
531 input,
532 attrNameStart,
533 attrNameEnd,
534 attrValueStart,
535 attrValueStart === -1 ? -1 : endPos,
536 attrQuoteType
537 );
538 }
539 if (attrNameStart !== -1) tagHasAttributes = true;
540 attrNameStart = -1;
541 attrValueStart = -1;
542 attrQuoteType = QUOTE_NONE;
543 return nextPos;
544 };
545
546 /**
547 * @param {number} endPos end position

Callers 1

walkHtmlTokensFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected