MCPcopy Index your code
hub / github.com/angular/angular / consumeStyleValue

Function consumeStyleValue

packages/core/src/render3/styling/styling_parser.ts:255–284  ·  view source on GitHub ↗
(text: string, startIndex: number, endIndex: number)

Source from the content-addressed store, hash-verified

253 * @returns Index after last style value character.
254 */
255export function consumeStyleValue(text: string, startIndex: number, endIndex: number): number {
256 let ch1 = -1; // 1st previous character
257 let ch2 = -1; // 2nd previous character
258 let ch3 = -1; // 3rd previous character
259 let i = startIndex;
260 let lastChIndex = i;
261 while (i < endIndex) {
262 const ch: number = text.charCodeAt(i++);
263 if (ch === CharCode.SEMI_COLON) {
264 return lastChIndex;
265 } else if (ch === CharCode.DOUBLE_QUOTE || ch === CharCode.SINGLE_QUOTE) {
266 lastChIndex = i = consumeQuotedText(text, ch, i, endIndex);
267 } else if (
268 startIndex === i - 4 && // We have seen only 4 characters so far "URL(" (Ignore "foo_URL()")
269 ch3 === CharCode.U &&
270 ch2 === CharCode.R &&
271 ch1 === CharCode.L &&
272 ch === CharCode.OPEN_PAREN
273 ) {
274 lastChIndex = i = consumeQuotedText(text, CharCode.CLOSE_PAREN, i, endIndex);
275 } else if (ch > CharCode.SPACE) {
276 // if we have a non-whitespace character then capture its location
277 lastChIndex = i;
278 }
279 ch3 = ch2;
280 ch2 = ch1;
281 ch1 = ch & CharCode.UPPER_CASE;
282 }
283 return lastChIndex;
284}
285
286/**
287 * Consumes all of the quoted characters.

Callers 1

parseStyleNextFunction · 0.85

Calls 1

consumeQuotedTextFunction · 0.85

Tested by

no test coverage detected