-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Textarea contents are parsed as empty if the source input is sufficiently large and contain un-escaped closing HTML tags #1929
Comments
I can't follow this - can you please simplify this to a testcase with the few pertinent HTML lines, and then an assertEquals for what you are expecting (vs what you are getting). Images of code are not helpful. |
Your report is 2174 lines long. This is still at least 2170 lines more than "a few". Please, work out the minimum amount of HTML that is triggering your issue, and clean up this report (edit the first submission, and delete your second) to only include that. You may use https://try.jsoup.org/ to easily see the parse results for a given input. |
Sorry,This bug only exists for a very long Html. I use https://try.jsoup.org/ see the parse results for a given input. It‘s still parsing is wrong. |
(Attached the reporter's original source HTML.) |
OK, I was able to reproduce this. Here's a simpler repro: public static void main(String[] args) {
StringBuilder sb = new StringBuilder();
int num = 2000;
for (int i = 0; i <= num; i++) {
sb.append("\n<text>foo</text>\n");
}
String textContent = sb.toString();
String sourceHtml = "<textarea>" + textContent + "</textarea>";
Document doc = Jsoup.parse(sourceHtml);
Element textArea = doc.expectFirst("textarea");
System.out.println("Text area parsed: " + textArea.wholeText().equals(textContent));
} Produces:
It looks like a buffering issue. If I set |
Thanks, fixed! |
Nice work! Thanks. |
Testing Html Parse that error. textarea Tag's innerText is not inner. innerText become textarea after tag.
test code:
The text was updated successfully, but these errors were encountered: