Skip to content

Instantly share code, notes, and snippets.

@sharifulin
Created May 20, 2011 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharifulin/982949 to your computer and use it in GitHub Desktop.
Save sharifulin/982949 to your computer and use it in GitHub Desktop.
Mojo::DOM bug: TR recursion
use ojo;
use Test::More tests => 2;
my $ok = q(
<table class="post_table">
<xtr>
<td>
<table class="reply_table">
<tr>
<td class="info">
<div class="wall_reply_text">Test</div>
</td>
</tr>
</table>
</td>
</xtr>
</table>
);
x( $ok )->find('.reply_table')->each(sub {
is shift->at('.wall_reply_text')->text, 'Test', 'Not recursion';
});
# fail
my $fail = q(
<table class="post_table">
<tr>
<td>
<table class="reply_table">
<tr>
<td class="info">
<div class="wall_reply_text">Test</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
);
x( $fail )->find('.reply_table')->each(sub {
is eval { shift->at('.wall_reply_text')->text }, 'Test', 'TR recursion';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment