Skip to content
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

Add testcase and fix for attributes deduplication in form and empty elements #1950

Merged
merged 5 commits into from
May 8, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix formatting in added code
To use spaces instead of tabs as rest of the file
  • Loading branch information
perlan committed May 6, 2023
commit a535795d09210bc5b04ffb4efdae8a3d51abab04
12 changes: 6 additions & 6 deletions src/main/java/org/jsoup/parser/HtmlTreeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ void error(HtmlTreeBuilderState state) {
}

Element insert(final Token.StartTag startTag) {
dedupliateTagAttributes(startTag);
dedupliateTagAttributes(startTag);

// handle empty unknown tags
// handle empty unknown tags
// when the spec expects an empty tag, will directly hit insertEmpty, so won't generate this fake end tag.
if (startTag.isSelfClosing()) {
Element el = insertEmpty(startTag);
Expand Down Expand Up @@ -262,7 +262,7 @@ private void insert(Element el, @Nullable Token token) {
}

Element insertEmpty(Token.StartTag startTag) {
dedupliateTagAttributes(startTag);
dedupliateTagAttributes(startTag);

Tag tag = tagFor(startTag.name(), settings);
Element el = new Element(tag, null, settings.normalizeAttributes(startTag.attributes));
Expand All @@ -279,7 +279,7 @@ Element insertEmpty(Token.StartTag startTag) {
}

FormElement insertForm(Token.StartTag startTag, boolean onStack, boolean checkTemplateStack) {
dedupliateTagAttributes(startTag);
dedupliateTagAttributes(startTag);

Tag tag = tagFor(startTag.name(), settings);
FormElement el = new FormElement(tag, null, settings.normalizeAttributes(startTag.attributes));
Expand Down Expand Up @@ -346,8 +346,8 @@ private void dedupliateTagAttributes(StartTag startTag) {
if (dupes > 0) {
error("Dropped duplicate attribute(s) in tag [%s]", startTag.normalName);
}
}
}
}
}

Element pop() {
int size = stack.size();
Expand Down