src/language/CSSUtils.js
function _parseSelector(ctx) {
            var selector = "";

            // Skip over {
            TokenUtils.movePrevToken(ctx);

            while (true) {
                if (ctx.token.type !== "comment") {
                    // Stop once we've reached a {, }, or ;
                    if (/[\{\}\;]/.test(ctx.token.string)) {
                        break;
                    }

                    // Stop once we've reached a <style ...> tag
                    if (ctx.token.string === "style" && ctx.token.type === "tag") {
                        // Remove everything up to end-of-tag from selector
                        var eotIndex = selector.indexOf(">");
                        if (eotIndex !== -1) {
                            selector = selector.substring(eotIndex + 1);
                        }
                        break;
                    }

                    selector = ctx.token.string + selector;
                }
                if (!TokenUtils.movePrevToken(ctx)) {
                    break;
                }
            }

            return selector;
        }
function _parseSelector(ctx) {
            var selector = "";

            // Skip over {
            TokenUtils.movePrevToken(ctx);

            while (true) {
                if (ctx.token.type !== "comment") {
                    // Stop once we've reached a {, }, or ;
                    if (/[\{\}\;]/.test(ctx.token.string)) {
                        break;
                    }

                    // Stop once we've reached a <style ...> tag
                    if (ctx.token.string === "style" && ctx.token.type === "tag") {
                        // Remove everything up to end-of-tag from selector
                        var eotIndex = selector.indexOf(">");
                        if (eotIndex !== -1) {
                            selector = selector.substring(eotIndex + 1);
                        }
                        break;
                    }

                    selector = ctx.token.string + selector;
                }
                if (!TokenUtils.movePrevToken(ctx)) {
                    break;
                }
            }

            return selector;
        }
function _parseSelector ( ctx ) { var selector = "" ; // Skip over { TokenUtils . movePrevToken ( ctx ) ; while ( true ) { if ( ctx . token . type !== "comment" ) { // Stop once we've reached a {, }, or ; if ( / [\{\}\;] / . test ( ctx . token . string ) ) { break ; } // Stop once we've reached a <style ...> tag if ( ctx . token . string === "style" && ctx . token . type === "tag" ) { // Remove everything up to end-of-tag from selector var eotIndex = selector . indexOf ( ">" ) ; if ( eotIndex !== - 1 ) { selector = selector . substring ( eotIndex + 1 ) ; } break ; } selector = ctx . token . string + selector ; } if ( ! TokenUtils . movePrevToken ( ctx ) ) { break ; } } return selector ; }
Parse a selector. Assumes ctx is pointing at the opening { that is after the selector name.
Parse a selector . Assumes ctx is pointing at the opening { that is after the selector name .