Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #737 from esse/master

wrong content in jruby when node includes new lines
  • Loading branch information...
commit 77e099a75d5878c13ef34e888541c2a0b8130075 2 parents 68ee05f + ddcbb98
@jvshahid jvshahid authored
Showing with 9 additions and 1 deletion.
  1. +1 −1  ext/java/nokogiri/XmlNode.java
  2. +8 −0 test/html/test_document.rb
View
2  ext/java/nokogiri/XmlNode.java
@@ -816,7 +816,7 @@ else if (this instanceof XmlDocument) {
if (node == null) {
textContent = "";
} else {
- textContent = ((Document)this.node).getDocumentElement().getTextContent().trim();
+ textContent = ((Document)this.node).getDocumentElement().getTextContent();
}
} else {
textContent = this.node.getTextContent();
View
8 test/html/test_document.rb
@@ -383,6 +383,14 @@ def test_doc_type
assert_equal "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd", html.internal_subset.system_id
assert_equal "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">", html.to_s[0,97]
end
+
+ def test_content_size
+ html = Nokogiri::HTML('<div>
+</div>')
+ assert_equal 1, html.content.size
+ assert_equal 1, html.content.split("").size
+ assert_equal "\n", html.content
+ end
def test_find_by_xpath
found = @html.xpath('//div/a')
Please sign in to comment.
Something went wrong with that request. Please try again.