src/tokenize.js
function consumeEscape (css, start) {
    let next = start;
    let code = css.charCodeAt(next + 1);
    if (unescapable[code]) {
        // just consume the escape char
    } else if (hex[code]) {
        let hexDigits = 0;
        // consume up to 6 hex chars
        do {
            next++;
            hexDigits++;
            code = css.charCodeAt(next + 1);
        } while (hex[code] && hexDigits < 6);
        // if fewer than 6 hex chars, a trailing space ends the escape
        if (hexDigits < 6 && code === t.space) {
            next++;
        }
    } else {
        // the next char is part of the current word
        next++;
    }
    return next;
}
function consumeEscape (css, start) {
    let next = start;
    let code = css.charCodeAt(next + 1);
    if (unescapable[code]) {
        // just consume the escape char
    } else if (hex[code]) {
        let hexDigits = 0;
        // consume up to 6 hex chars
        do {
            next++;
            hexDigits++;
            code = css.charCodeAt(next + 1);
        } while (hex[code] && hexDigits < 6);
        // if fewer than 6 hex chars, a trailing space ends the escape
        if (hexDigits < 6 && code === t.space) {
            next++;
        }
    } else {
        // the next char is part of the current word
        next++;
    }
    return next;
}
function consumeEscape ( css , start ) { let next = start ; let code = css . charCodeAt ( next + 1 ) ; if ( unescapable [ code ] ) { // just consume the escape char } else if ( hex [ code ] ) { let hexDigits = 0 ; // consume up to 6 hex chars do { next ++ ; hexDigits ++ ; code = css . charCodeAt ( next + 1 ) ; } while ( hex [ code ] && hexDigits < 6 ) ; // if fewer than 6 hex chars, a trailing space ends the escape if ( hexDigits < 6 && code === t . space ) { next ++ ; } } else { // the next char is part of the current word next ++ ; } return next ; }
Returns the last index of the escape sequence
@param {string} css The string in which the sequence begins
@param {number} start The index into the string where escape character (`\`) occurs.
Returns the last index of the escape sequence