-
-
Notifications
You must be signed in to change notification settings - Fork 904
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
[bug] Calling to_html
on Nokogiri::XML::Attr
raises Unsupported document node (2)
exception
#3125
Comments
The HTML4 serialization is a little strange with its leading space. That seems kind of like an implementation detail of libxml2. Is that behavior we want to replicate? |
@stevecheckoway I don't think we want to replicate that space, at least not as part of the attribute's serialization. |
I've verified that serializing attributes like this has not worked since Nokogumbo was merged into Nokogiri in v1.12.0. Will open a PR shortly. |
Previously an exception would be raised, either "Unexpected node" or "Unsupported document node (2)" depending on the version of Nokogiri. Fixes #3125
Previously an exception would be raised, either "Unexpected node" or "Unsupported document node (2)" depending on the version of Nokogiri. Fixes #3125
Previously an exception would be raised, either "Unexpected node" or "Unsupported document node (2)" depending on the version of Nokogiri. Fixes #3125
Previously an exception would be raised, either "Unexpected node" or "Unsupported document node (2)" depending on the version of Nokogiri. Fixes #3125
**What problem is this PR intended to solve?** Previously an exception would be raised, either "Unexpected node" or "Unsupported document node (2)" depending on the version of Nokogiri. Fixes #3125 **Have you included adequate test coverage?** Yes. **Does this change affect the behavior of either the C or the Java implementations?** HTML5 is only available in CRuby.
Thank you for the quick fix! 🙏🏼 |
👍 Hoping to get a release out in the next few days. Ping me if it becomes urgent. |
Please describe the bug
Calling
to_html
on aNokogiri::XML::Attr
instance, parsed viaHTML5::DocumentFragment
is raising anUnsupported docu ment node (2); this is a bug in Nokogiri (RuntimeError)
exception here.Help us reproduce what you're seeing
Expected behavior
I expect the attribute to be converted to HTML and not raise the following error:
It seems like the same call is working fine in HTML4:
Environment
Additional context
I found this while trying to update my parse call form
HTML4
toHTML5
here with these tests:https://github.com/marcoroth/phlexing/blob/28f7d6970b69b22c425d2ccea064ecffd8d189ba/gem/test/phlexing/converter/tags_test.rb#L219-L237
I got the failing tests in this PR: marcoroth/phlexing#288
The text was updated successfully, but these errors were encountered: