Parses a string into a CSSSelectorList.

@param selectors the input string
@return the css selector list
@throws IOException if the underlying SAC parser throws an IOException
554113
public SelectorList parseSelectors(final String selectors) throws IOException {
        try (InputSource source = new InputSource(new StringReader(selectors))) {
            final HandlerBase handler = new HandlerBase();
            parser_.setDocumentHandler(handler);
            return parser_.parseSelectors(source);
        }
    }
1169043
function parseSelector() {
    while (!source.isAtEnd()) {
      var token = source.first();

      switch (token) {
        case '.':
          return cssSelector();
        case '#':
          return cssSelector();
        case '{':
          source.shift();
          if (useHash) {
            return hashSelectorContent();
          } else {
            return parseSelectorContent();
          }

        case '/':
          cssComment();
          break;
        case "'":
          singleQuoteString();
          break;
        case '"':
          doubleQuoteString();
          break;
        default:
          source.shift();
      }
    }
  }
403433
private String decodeAndEscapeSelectors(FacesContext context, UIComponent component, String selector) {
		selector = ExpressionResolver.getComponentIDs(context, component, selector);
		selector = BsfUtils.escapeJQuerySpecialCharsInSelector(selector);

		return selector;
	}
923691
function querySelector(selector) {
    init();
    if (!selector) {
      return tokens;
    }
    var match = selector.match(
      /^\s*([\w_-]*)((\s*\[[\w_-]+\s*=\s*("([^\\"]*(\\.)*)*"|'([^\\']*(\\.)*)*'|[^\[\]]*)\])*)\s*(\*?)$/
    );
    if (!match) {
      console.warn(colors.blue('Invalid selector expressions %j.'), selector);
      return;
    }
    var tag = match[1];
    var attributes = [];
    var all = match[9] === '*';
    match[2].replace(/\s*\[([\w_-]+)\s*=\s*("([^\\"]*(\\.)*)*"|'([^\\']*(\\.)*)*'|[^\[\]]*)\]/g,
      function (match, name, value) {
        if (/^['"]/.test(value)) {
          /*jslint evil: true */
          value = new Function('return (' + value + ');')();
        }
        attributes.push({
          name: name,
          value: value
        });
      }
    );
    function check(node) {
      if (!node || !node.attrs) {
        return;
      }
      var flag;
      if (!tag || node.tag === tag) {
        flag = true;
        attributes.every(function (item) {
          if (item.value !== node.attrs[item.name]) {
            flag = false;
          }
          return flag;
        });
      }
      return flag;
    }
    var items;
    function scan(node) {
      if (check(node)) {
        if (items) {
          items.push(node);
        }
        return node;
      }
      var result;
      if (node.nodes) {
        node.nodes.every(function (item) {
          result = scan(item);
          return items || !result;
        });
      }
      return result;
    }
    if (all) {
      items = [];
      scan(tokens);
      return items;
    }
    else {
      return scan(tokens);
    }
  }
1116689
public CSSStyleDeclarationImpl parseStyleDeclaration(final String styleDecl) throws IOException {
        final CSSStyleDeclarationImpl sd = new CSSStyleDeclarationImpl(null);
        parseStyleDeclaration(sd, styleDecl);
        return sd;
    }
1041422
public void setSelectorText(final String selectorText) throws DOMException {
        try {
            final CSSOMParser parser = new CSSOMParser();
            selectors_ = parser.parseSelectors(selectorText);
        }
        catch (final CSSException e) {
            throw new DOMExceptionImpl(
                DOMException.SYNTAX_ERR,
                DOMExceptionImpl.SYNTAX_ERROR,
                e.getMessage());
        }
        catch (final IOException e) {
            throw new DOMExceptionImpl(
                DOMException.SYNTAX_ERR,
                DOMExceptionImpl.SYNTAX_ERROR,
                e.getMessage());
        }
    }
789575
function _findMatchingRulesInCSSFiles(selector, resultSelectors) {
        var result          = new $.Deferred();

        // Load one CSS file and search its contents
        function _loadFileAndScan(fullPath, selector) {
            var oneFileResult = new $.Deferred();

            DocumentManager.getDocumentForPath(fullPath)
                .done(function (doc) {
                    // Find all matching rules for the given CSS file's content, and add them to the
                    // overall search result
                    var oneCSSFileMatches = _findAllMatchingSelectorsInText(doc.getText(), selector, doc.getLanguage().getMode());
                    _addSelectorsToResults(resultSelectors, oneCSSFileMatches, doc, 0);

                    oneFileResult.resolve();
                })
                .fail(function (error) {
                    console.warn("Unable to read " + fullPath + " during CSS rule search:", error);
                    oneFileResult.resolve();  // still resolve, so the overall result doesn't reject
                });

            return oneFileResult.promise();
        }

        ProjectManager.getAllFiles(ProjectManager.getLanguageFilter(["css", "less", "scss"]))
            .done(function (cssFiles) {
                // Load index of all CSS files; then process each CSS file in turn (see above)
                Async.doInParallel(cssFiles, function (fileInfo, number) {
                    return _loadFileAndScan(fileInfo.fullPath, selector);
                })
                    .then(result.resolve, result.reject);
            });

        return result.promise();
    }
405239
function (selectorText) {
            var rule, css, selector, cssRules = this.cssRules;
            if (selectorText) {
                rule = cssRules[selectorText];
                return rule ? rule.style.cssText : null;
            } else {
                css = [];
                for (selector in cssRules) {
                    rule = cssRules[selector];
                    css.push(rule.selectorText + ' {' + rule.style.cssText + '}');
                }
                return css.join('\n');
            }
        }
467766
function (selector) {
        var match = this.match;

        function compileNameFilter(name) {
          if (name) {
            name = name.toLowerCase();

            return function (item) {
              return name === '*' || item.type === name;
            };
          }
        }

        function compileIdFilter(id) {
          if (id) {
            return function (item) {
              return item._name === id;
            };
          }
        }

        function compileClassesFilter(classes) {
          if (classes) {
            classes = classes.split('.');

            return function (item) {
              var i = classes.length;

              while (i--) {
                if (!item.classes.contains(classes[i])) {
                  return false;
                }
              }

              return true;
            };
          }
        }

        function compileAttrFilter(name, cmp, check) {
          if (name) {
            return function (item) {
              var value = item[name] ? item[name]() : '';

              return !cmp ? !!check :
                cmp === "=" ? value === check :
                  cmp === "*=" ? value.indexOf(check) >= 0 :
                    cmp === "~=" ? (" " + value + " ").indexOf(" " + check + " ") >= 0 :
                      cmp === "!=" ? value != check :
                        cmp === "^=" ? value.indexOf(check) === 0 :
                          cmp === "$=" ? value.substr(value.length - check.length) === check :
                            false;
            };
          }
        }

        function compilePsuedoFilter(name) {
          var notSelectors;

          if (name) {
            name = /(?:not\((.+)\))|(.+)/i.exec(name);

            if (!name[1]) {
              name = name[2];

              return function (item, index, length) {
                return name === 'first' ? index === 0 :
                  name === 'last' ? index === length - 1 :
                    name === 'even' ? index % 2 === 0 :
                      name === 'odd' ? index % 2 === 1 :
                        item[name] ? item[name]() :
                          false;
              };
            }

            // Compile not expression
            notSelectors = parseChunks(name[1], []);

            return function (item) {
              return !match(item, notSelectors);
            };
          }
        }

        function compile(selector, filters, direct) {
          var parts;

          function add(filter) {
            if (filter) {
              filters.push(filter);
            }
          }

          // Parse expression into parts
          parts = expression.exec(selector.replace(whiteSpace, ''));

          add(compileNameFilter(parts[1]));
          add(compileIdFilter(parts[2]));
          add(compileClassesFilter(parts[3]));
          add(compileAttrFilter(parts[4], parts[5], parts[6]));
          add(compilePsuedoFilter(parts[7]));

          // Mark the filter with pseudo for performance
          filters.pseudo = !!parts[7];
          filters.direct = direct;

          return filters;
        }

        // Parser logic based on Sizzle by John Resig
        function parseChunks(selector, selectors) {
          var parts = [], extra, matches, i;

          do {
            chunker.exec("");
            matches = chunker.exec(selector);

            if (matches) {
              selector = matches[3];
              parts.push(matches[1]);

              if (matches[2]) {
                extra = matches[3];
                break;
              }
            }
          } while (matches);

          if (extra) {
            parseChunks(extra, selectors);
          }

          selector = [];
          for (i = 0; i < parts.length; i++) {
            if (parts[i] != '>') {
              selector.push(compile(parts[i], [], parts[i - 1] === '>'));
            }
          }

          selectors.push(selector);

          return selectors;
        }

        this._selectors = parseChunks(selector, []);
      }
851864
public void setSelectors(java.util.Collection<Selector> selectors) {
        if (selectors == null) {
            this.selectors = null;
            return;
        }

        this.selectors = new com.amazonaws.internal.SdkInternalList<Selector>(selectors);
    }
714290
public Selector parseSelector(String selectorString,
                                SelectorDomain domain) throws SISelectorSyntaxException
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "parseSelector", new Object[] { selectorString, domain });
    
    Selector selectorTree = mpm.parseSelector(selectorString, domain);
       
    if (tc.isEntryEnabled()) SibTr.exit(tc, "parseSelector", selectorTree);
    return selectorTree;       
  }
1122352
public static String escapeJQuerySpecialCharsInSelector(String selector) {
		String jQuerySpecialChars = "!\"#$%&'()*+,./:;<=>?@[]^`{|}~;";
		String[] jsc = jQuerySpecialChars.split("(?!^)");
		for(String c: jsc) {
			selector = selector.replace(c, "\\\\" + c);
		}
		return selector;
	}
100485
private void checkAsCss(InputSource is) throws IOException, SAXException {
        String charset = "UTF-8";
        if (is.getEncoding() != null) {
            charset = is.getEncoding();
        }
        List<InputStream> streamsList = new ArrayList<>();
        streamsList.add(new ByteArrayInputStream(CSS_CHECKING_PROLOG));
        streamsList.add(is.getByteStream());
        streamsList.add(new ByteArrayInputStream(CSS_CHECKING_EPILOG));
        Enumeration<InputStream> streams = Collections.enumeration(streamsList);
        is.setByteStream(new SequenceInputStream(streams));
        is.setEncoding(charset);
        sourceCode.setIsCss();
        sourceCode.initialize(is);
        try {
            htmlReader.parse(is);
        } catch (SAXParseException e) {
        }
    }
847060
function ( selector ) {
            var node = this.element().nextSibling;
            if ( !node ) return;
    
            //comment, text
            if ( node.nodeType == 8 || node.nodeType == 3 && !$B.string.trim(node.data) ) {
                return $B( node ).next( selector );
            } else {
                if ( typeof selector === 'string' ) node = $B.selector.match( node, selector )? node : undefined;
                return node;
            }
        }
1322660
static String[] split( String selectors ) {
        ArrayList<String> result = null;
        int length = selectors.length();
        char quote = 0;
        int off = 0;
        for( int i = 0; i < length; i++ ) {
            char ch = selectors.charAt( i );
            switch( ch ) {
                case ',':
                    if( result == null ) {
                        result = new ArrayList<>();
                    }
                    result.add( selectors.substring( off, i ).trim() );
                    off = i + 1;
                    break;
                case '\'':
                case '\"':
                    do {
                        i++;
                    } while( i < length && selectors.charAt( i ) != ch );
            }
        }
        if( result == null ) {
            return new String[] { selectors.trim() };
        }
        result.add( selectors.substring( off, length ).trim() );
        return result.toArray( new String[result.size()] );
    }
294130
function getSelectors(selector){

	let ary = [];
	for ( let i=0,isCls=false,tmp='',len=selector.length,ch; i<len; i++ ) {
		ch = selector.charAt(i);
		if ( ch == '.' ) {
			// 类名开始，已有串即使空白，都直接推入数组
			ary.push(tmp);
			tmp = ch;
			isCls = true;	// 当前是类名
		}else{
			if ( BREAKS.indexOf(ch) >= 0 ) {
				// 选择器分隔字符
				if ( isCls ) {
					// 之前是类名，推入数组
					ary.push(tmp);
					tmp = ch;
					isCls = false; // 当前不是类名了
				}else{
					// 之前不是类名，继续拼接
					tmp += ch;
				}
			}else{
				// 不是分隔字符，继续拼接
				tmp += ch;
			}
		}

		if ( i == len-1 ) {
			// 最后一位，已有串即使空白，都直接推入数组
			ary.push(tmp);
		}
	}

	return ary.filter(v => v !== ''); // 过滤去除纯粹的空串
}
993169
public static CssSel sel(String selector, String value) {
	return j.sel(selector, value);
    }