Skip to content

Commit d80275e

Browse files
committed
Performance tweak when appending tag names
For some crafted HTML, this path was accumulating an ultra-long tag name. Removed redundant
1 parent 4b733b1 commit d80275e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/org/jsoup/parser/Token.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ final void appendTagName(String append) {
258258
// might have null chars - need to replace with null replacement character
259259
append = append.replace(TokeniserState.nullChar, Tokeniser.replacementChar);
260260
tagName = tagName == null ? append : tagName.concat(append);
261-
normalName = ParseSettings.normalName(tagName);
261+
// perf: normalize just the appended content
262+
String normalAppend = ParseSettings.normalName(append);
263+
normalName = normalName == null ? normalAppend : normalName.concat(normalAppend);
262264
}
263265

264266
final void appendTagName(char append) {

0 commit comments

Comments
 (0)