MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / getSelectorList

Method getSelectorList

src/main/java/org/htmlunit/html/DomNode.java:2076–2097  ·  view source on GitHub ↗

Returns the SelectorList. @param selectors the selectors @param webClient the WebClient @return the SelectorList @throws IOException if an error occurs

(final String selectors, final WebClient webClient)

Source from the content-addressed store, hash-verified

2074 * @throws IOException if an error occurs
2075 */
2076 protected SelectorList getSelectorList(final String selectors, final WebClient webClient)
2077 throws IOException {
2078
2079 // get us a CSS3Parser from the pool so the chance of reusing it are high
2080 try (PooledCSS3Parser pooledParser = webClient.getCSS3Parser()) {
2081 final CSSOMParser parser = new CSSOMParser(pooledParser);
2082 final CheckErrorHandler errorHandler = new CheckErrorHandler();
2083 parser.setErrorHandler(errorHandler);
2084
2085 final SelectorList selectorList = parser.parseSelectors(selectors);
2086 // in case of error parseSelectors returns null
2087 if (errorHandler.error() != null) {
2088 throw new CSSException("Invalid selectors: '" + selectors + "'", errorHandler.error());
2089 }
2090
2091 if (selectorList != null) {
2092 CssStyleSheet.validateSelectors(selectorList, this);
2093
2094 }
2095 return selectorList;
2096 }
2097 }
2098
2099 /**
2100 * Returns the first element within the document that matches the specified group of selectors.

Callers 3

querySelectorAllMethod · 0.95
closestMethod · 0.95
matchesMethod · 0.80

Calls 4

errorMethod · 0.95
validateSelectorsMethod · 0.95
getCSS3ParserMethod · 0.80
parseSelectorsMethod · 0.80

Tested by

no test coverage detected