Parsing <tr>
as a document fragment doesn't work
#3424
-
I can't understand why the HTML isn't a valid fragment and thus Nokogiri is stripping out the I can make this work by using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @davetron5000, If you ask Nokogiri for errors, you'll see what's going on:
I think the easiest thing to do here (and something @flavorjones and I have discussed making the default but I don't recall what we decided about that to be honest) is to make irb(main):012:0> frag = Nokogiri::HTML5::DocumentFragment.parse("<tr><td>Hi</td></tr>", context: 'template', max_errors:
100)
=>
#(DocumentFragment:0x55a00 {
...
irb(main):013:0> frag.errors.empty?
=> true
irb(main):014:0> frag.to_s
=> "<tr><td>Hi</td></tr>" |
Beta Was this translation helpful? Give feedback.
Hi @davetron5000,
If you ask Nokogiri for errors, you'll see what's going on:
I think the easiest thing to do here (and something @flavorjones and I have discussed making the default but I don't recall what we decided about that to be honest) is to make
template
be your context.