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

Erronious error: "no contextual parsing on unlinked nodes" for top-level node #281

Closed
bananastalktome opened this issue May 25, 2010 · 1 comment

Comments

@bananastalktome
Copy link

Issue when parsing top-level node in document fragments with nokogiri 1.4.2:
(gist at http://gist.github.com/413419)

$ irb 
>> a = "<br><p>Hey</p>"
=> "<br><p>Hey</p>"
>> b = Nokogiri::HTML.fragment a
=> #<Nokogiri::HTML::DocumentFragment:0x455e318 name="#document-fragment" children=[#<Nokogiri::XML::Element:0x455e14a name="br">, #<Nokogiri::XML::Element:0x455e12e name="p" children=[#<Nokogiri::XML::Text:0x455dba8 "Hey">]>]>
>> b.inner_html
=> "<br><p>Hey</p>"
>> b.inner_html = ""
RuntimeError: no contextual parsing on unlinked nodes
        from /local/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2/lib/nokogiri/xml/node.rb:443:in `in_context'
        from /local/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2/lib/nokogiri/xml/node.rb:443:in `parse'
        from /local/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2/lib/nokogiri/html/document_fragment.rb:16:in `initialize'
        from /local/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2/lib/nokogiri/xml/node.rb:424:in `new'
        from /local/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2/lib/nokogiri/xml/node.rb:424:in `fragment'
        from /local/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2/lib/nokogiri/xml/node.rb:776:in `coerce'
        from /local/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2/lib/nokogiri/xml/node.rb:313:in `inner_html='
        from (irb):6
        from /local/bin/irb:12:in `<main>'
@tenderlove
Copy link
Member

This should be fixed here: 67a41b5

Thanks for reporting the error!

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

No branches or pull requests

2 participants