Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.htmlunit.WebResponse;
import org.htmlunit.cyberneko.HTMLConfiguration;
import org.htmlunit.cyberneko.HTMLElements;
import org.htmlunit.cyberneko.HTMLElementsCollection;
import org.htmlunit.cyberneko.HTMLScanner;
import org.htmlunit.cyberneko.HTMLTagBalancingListener;
import org.htmlunit.cyberneko.xerces.parsers.AbstractSAXParser;
Expand Down Expand Up @@ -97,8 +98,7 @@
implements ContentHandler, LexicalHandler, HTMLTagBalancingListener, HTMLParserDOMBuilder {

// cache Neko Elements for performance and memory efficiency
private static final HTMLElements HTMLELEMENTS;
private static final HTMLElements HTMLELEMENTS_WITH_CMD;
private static final HTMLElementsCollection HTMLELEMENTSCOLLECTION_WITH_CMD;

static {
// continue short code enumeration
Expand All @@ -107,11 +107,7 @@
final HTMLElements.Element command = new HTMLElements.Element(commandShortCode, "COMMAND",
HTMLElements.Element.EMPTY, new short[] {HTMLElements.BODY, HTMLElements.HEAD}, null);

HTMLELEMENTS = new HTMLElements();

final HTMLElements value = new HTMLElements();
value.setElement(command);
HTMLELEMENTS_WITH_CMD = value;
HTMLELEMENTSCOLLECTION_WITH_CMD = new HTMLElementsCollection(command);
}

private enum HeadParsed { YES, SYNTHESIZED, NO }
Expand Down Expand Up @@ -207,10 +203,15 @@
* @return the configuration
*/
private static XMLParserConfiguration createConfiguration(final BrowserVersion browserVersion) {
// it is important to use a new instance of HTMLElements every time to

Check failure on line 206 in src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java

View workflow job for this annotation

GitHub Actions / CheckStyle

[checkstyle] reported by reviewdog 🐶 Trailing whitespace found. Raw Output: /home/runner/work/htmlunit/htmlunit/src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java:206:0: error: Trailing whitespace found. (com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck)
// avoid concurrency issues due to the internal state of HTMLElements which allows
// caching of results, especially lookup misses
if (browserVersion.hasFeature(HTML_COMMAND_TAG)) {
return new HTMLConfiguration(HTMLELEMENTS_WITH_CMD);
return new HTMLConfiguration(new HTMLElements(HTMLELEMENTSCOLLECTION_WITH_CMD));
}
else {
return new HTMLConfiguration(new HTMLElements(HTMLElementsCollection.DEFAULT));
}
return new HTMLConfiguration(HTMLELEMENTS);
}

/**
Expand Down
Loading