Skip to content

Parsing <tr> as a document fragment doesn't work #3424

Closed Answered by stevecheckoway
davetron5000 asked this question in General Q&A
Discussion options

You must be logged in to vote

Hi @davetron5000,

If you ask Nokogiri for errors, you'll see what's going on:

1:1: ERROR: Start tag 'tr' isn't allowed here. Currently open tags: html.
<tr><td>Hi</td></tr>
^
1:5: ERROR: Start tag 'td' isn't allowed here. Currently open tags: html.
<tr><td>Hi</td></tr>
    ^
1:11: ERROR: End tag 'td' isn't allowed here. Currently open tags: html.
<tr><td>Hi</td></tr>
          ^
1:16: ERROR: End tag 'tr' isn't allowed here. Currently open tags: html.
<tr><td>Hi</td></tr>
               ^

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.

irb(

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@davetron5000
Comment options

@stevecheckoway
Comment options

@flavorjones
Comment options

Answer selected by davetron5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants