MCPcopy
hub / github.com/vitejs/vite / serializeAttrs

Function serializeAttrs

packages/vite/src/node/plugins/html.ts:1640–1650  ·  view source on GitHub ↗
(attrs: HtmlTagDescriptor['attrs'])

Source from the content-addressed store, hash-verified

1638}
1639
1640function serializeAttrs(attrs: HtmlTagDescriptor['attrs']): string {
1641 let res = ''
1642 for (const key in attrs) {
1643 if (typeof attrs[key] === 'boolean') {
1644 res += attrs[key] ? ` ${key}` : ``
1645 } else {
1646 res += ` ${key}="${escapeHtml(attrs[key])}"`
1647 }
1648 }
1649 return res
1650}
1651
1652function incrementIndent(indent: string = '') {
1653 return `${indent}${indent[0] === '\t' ? '\t' : ' '}`

Callers 1

serializeTagFunction · 0.85

Calls 1

escapeHtmlFunction · 0.85

Tested by

no test coverage detected