MCPcopy
hub / github.com/webpack/webpack / attrSourceSpan

Function attrSourceSpan

lib/html/HtmlParser.js:132–141  ·  view source on GitHub ↗
(source, attr)

Source from the content-addressed store, hash-verified

130 * @returns {string} the attribute's source slice
131 */
132const attrSourceSpan = (source, attr) => {
133 const end =
134 attr.valueStart === -1
135 ? attr.nameEnd
136 : source.charCodeAt(attr.valueStart - 1) === CC_QUOTATION ||
137 source.charCodeAt(attr.valueStart - 1) === CC_APOSTROPHE
138 ? attr.valueEnd + 1
139 : attr.valueEnd;
140 return source.slice(attr.nameStart - 1, end);
141};
142
143// eslint-disable-next-line no-control-regex
144const IGNORE_CHARS_REGEXP = /[\u0000-\u001F\u007F-\u009F\u00A0]/g;

Callers 1

parseMethod · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected