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

.attr("name") on DocumentType returns empty string since 1.18.2 #2241

Closed
borkdude opened this issue Dec 6, 2024 · 3 comments
Closed

.attr("name") on DocumentType returns empty string since 1.18.2 #2241

borkdude opened this issue Dec 6, 2024 · 3 comments
Labels
Milestone

Comments

@borkdude
Copy link

borkdude commented Dec 6, 2024

In version 1.18.2 the .documentType on a document as parsed from "<!DOCTYPE html>" returns an empty string for the name attribute:

DocumentType dt = Jsoup.parse("<!DOCTYPE html>");
dt.attr("name") // "html" in 1.18.1 but "" in 1.18.2 and .3

Is this intentional or a bug? This surfaced when I tried to upgrade Jsoup in the hickory library for Clojure:

https://github.com/clj-commons/hickory

@borkdude borkdude changed the title .attr("name") on DocumentType returns null since 1.18.2 .attr("name") on DocumentType returns empty string since 1.18.2 Dec 6, 2024
@borkdude
Copy link
Author

borkdude commented Dec 6, 2024

It seems the breaking change was made here:

4690661#diff-a23756c0ecd21ca15e014227dbbf76ece534fe3afa1139b103a5a5b565ee8137L16

@jhy jhy closed this as completed in ed23a9a Dec 7, 2024
@jhy
Copy link
Owner

jhy commented Dec 7, 2024

Hi Michiel,

I reverted it so that using .attr("name") will work again. I had considered these internal attributes and so that the specific key used would not matter (as the defined API to get the name is doctype.name()), but effectively, yes, they are part of the public API.

Thanks for raising!

@jhy jhy added this to the 1.19.1 milestone Dec 7, 2024
@jhy jhy added the fixed label Dec 7, 2024
@borkdude
Copy link
Author

borkdude commented Dec 7, 2024

@jhy Sweet! I'll wait for the next release. Thanks so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants