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

JRuby-Nokogiri has different comment node name #1080

Closed
denisdefreyne opened this issue Apr 14, 2014 · 1 comment
Closed

JRuby-Nokogiri has different comment node name #1080

denisdefreyne opened this issue Apr 14, 2014 · 1 comment

Comments

@denisdefreyne
Copy link

The node name for comments is "comment" on MRI, but "#comment" on JRuby.

Steps to reproduce

Run the following on JRuby:

input = %[
<link rel="stylesheet" href="/foo.css" />
<!--[if lt IE 9]>
    <script src="/js/lib/html5shiv.js"></script>
<![endif]-->
]

require 'nokogiri'
doc = Nokogiri::HTML.parse(input)
comment_nodes = doc.xpath('descendant-or-self::comment()')
p comment_nodes.first.name

Expected output

Result from JRuby:

% ruby test.rb
"#comment"
%

Actual output

Result from MRI:

% ruby test.rb
"comment"
%
@denisdefreyne denisdefreyne changed the title Comment node name differs between MRI and JRuby JRuby-Nokogiri has different comment node name Apr 14, 2014
@knu knu added the jruby label Apr 15, 2014
@yokolet
Copy link
Member

yokolet commented Apr 16, 2014

Thanks for reporting.
This bug has been fixed by the commit, 280c995

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

No branches or pull requests

3 participants