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
Entity reference causes DocumentFragment to lowercase attribute names #961
Comments
More weirdness: bad_xml = '<foo>
<svg viewBox="0 0 30 16"/>
Hey ⊗ what?
</foo>'
bad_xml_with_doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<foo>
<svg viewBox="0 0 30 16"/>
Hey ⊗ what?
</foo>'
puts "With DOCTYPE"
puts Nokogiri::XML(bad_xml_with_doctype).root.to_xml
puts "But not as a Fragment:"
puts Nokogiri::XML(bad_xml_with_doctype).fragment(bad_xml).to_xml Produces:
So even when I have a nice document parsed with a doctype, creating a fragment off that lowercases the attributes! |
Was this ever determined to be a bug or expected behavior? Since needing to add |
stadelmanma
added a commit
to stadelmanma/sablon
that referenced
this issue
Mar 5, 2018
Without this Nokogiri will downcase the attributes for some reason which I assume must be expected behavior since the issue hasn't been fixed. Issue Reference: sparklemotion/nokogiri#961
stadelmanma
added a commit
to senny/sablon
that referenced
this issue
Mar 7, 2018
This appears to be needed due to a long standing bug in nokogiri, see commits below. All '&' now get replaced with '&'. * Escape all ampersands in relationship nodes with '&' Without this Nokogiri will downcase the attributes for some reason which I assume must be expected behavior since the issue hasn't been fixed. Issue Reference: sparklemotion/nokogiri#961 * Update HTML insertion integration test This test ensures URL get their ampeersands escaped correctly without interfering with ones that are already escaped.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using Nokogiri 1.6.0 on Ruby 2.0.0p0 (OSX)
This prints:
What's happening here is that adding the
⊗
reference causes the document fragment to lowercase theviewBox
attribute!As a bonus, if I use the normal
DocumentFragment.parse
method, I just don't get any entity at all.It's important to use an "uncommon" entity reference - stuff like
&
or→
doesn't trigger this bug.The text was updated successfully, but these errors were encountered: