Hpricot's html
method spits out just the HTML in the document:
> Hpricot('<p>a</p>').html
=> "<p>a</p>"
By contrast, the closest I can come with Nokogiri is the inner_html
method, which wraps its output in <html>
and <body>
tags:
> Nokogiri.HTML('<p>a</p>').inner_html
=> "<html><body><p>a</p></body></html>"
How can I get the behavior of Hpricot's html
method with Nokogiri? I.e., I want this:
> Nokogiri.HTML('<p>a</p>').some_method_i_dont_know_about
=> "<p>a</p>"
` (e.g., `Nokogiri::HTML("a\nb").inner_html`), so it's best to avoid it altogether. Is `Nokogiri::HTML::DocumentFragment` equivalent to the `Hpricot` method?
– Tom Lehman Jan 30 '11 at 04:18