Skip to content

Conversation

@sneha-patil-synacor
Copy link

@sneha-patil-synacor sneha-patil-synacor commented Sep 26, 2019

Sample HTML code:

<TABLE border='0' cellspacing='0' cellpadding='4' width='1100'> <TR height='30' bgcolor='#7FED4B'><TD style='white-space:nowrap' colspan='9'><B><FONT size='+2' class='font-large'>&nbsp;Green Zone &#8212; Bulk mail, including subscriptions and advertisements</FONT></B><TD class='right' align='right'><B><FONT size='+1' class='font-medium'>21 entries&nbsp;</FONT></B> <TR align='left' bgcolor='#E3E2E2'><TH width='50'>View<TH width='36'>Type<TH width='100'>Date<TH width='75'>Time<TH width='75'>Size<TH width='35'>Country<TH width='150'>Sender<TH width='200'>Mailbox<TH width='200'>Subject<TH width='100%'>Direction <TR> <TD height='22' width='50'><A href='http://example.com'>View</A> <TD height='22' width='36'>Junk <TD height='22' width='100'>Mar&nbsp;26 <TD height='22' width='75'>9:02<SPAN class='am'><font size='-1' class='am'>PM</font></SPAN> <TD height='22' width='75'>25KB <TD height='22' width='35'>US <TD height='22' width='150'>ABC <TD height='22' width='200'>&lt;468b.1c.195562763.slnl...@example.org&gt; <TD height='22' width='200'>Teacher Evaluation <TD height='22' width='75'>Inbound 

Sanitized code before fix(Using Sanitizers.TABLES policy):

<table><tbody><tr><td> Green Zone — Bulk mail, including subscriptions and advertisements</td><td align="right">21 entries <table><tbody><tr align="left"><th>View<table><tbody><tr><th>Type<table><tbody><tr><th>Date<table><tbody><tr><th>Time<table><tbody><tr><th>Size<table><tbody><tr><th>Country<table><tbody><tr><th>Sender<table><tbody><tr><th>Mailbox<table><tbody><tr><th>Subject<table><tbody><tr><th>Direction <table><tbody><tr><td>View </td><td>Junk </td><td>Mar 26 </td><td>9:02PM </td><td>25KB </td><td>US </td><td>ABC </td><td>&lt;468b.1c.195562763.slnl...&#64;example.org&gt; </td><td>Teacher Evaluation </td><td>Inbound </td></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></th></tr></tbody></table></td></tr></tbody></table> 

Sanitized code after fix(Using Sanitizers.TABLES policy):

<table><tbody><tr><td> Green Zone — Bulk mail, including subscriptions and advertisements</td><td align="right">21 entries </td></tr><tr align="left"><th>View</th><th>Type</th><th>Date</th><th>Time</th><th>Size</th><th>Country</th><th>Sender</th><th>Mailbox</th><th>Subject</th><th>Direction </th></tr><tr><td>View </td><td>Junk </td><td>Mar 26 </td><td>9:02PM </td><td>25KB </td><td>US </td><td>ABC </td><td>&lt;468b.1c.195562763.slnl...&#64;example.org&gt; </td><td>Teacher Evaluation </td><td>Inbound </td></tr></tbody></table> 

SampleTable

@mikesamuel
Copy link
Contributor

Could you add your example as a unittest?

new int[] { TABLE_TAG, TBODY_TAG, TR_TAG }),
new FreeWrapper(
TR_TAG, new int[] { TBODY_TAG, THEAD_TAG, TFOOT_TAG, TR_TAG },
TR_TAG, new int[] { TBODY_TAG, THEAD_TAG, TFOOT_TAG, TR_TAG, TD_TAG, TH_TAG },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are TD & TH required here?

Copy link
Author

@sneha-patil-synacor sneha-patil-synacor Oct 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are three rows in this table.
Without TD, it starts new table from second table row
Without TH, it starts new table from third table row

@sneha-patil-synacor
Copy link
Author

sneha-patil-synacor commented Oct 3, 2019

Could you add your example as a unittest?

Added testTableStructure unit test into ExamplesTest.java with minimized code version of given example

mikesamuel added a commit that referenced this pull request Oct 12, 2019
This pulls PR #186 locally and moves the unittest to a different file. I believe this addresses issue #137
@mikesamuel
Copy link
Contributor

mikesamuel commented Oct 12, 2019

I pulled your fix locally, tested it, and moved the test to a different file.

66794b6 is your patch.
7fa3aa1 adds you to docs/credits.md.

Thanks much.

@mikesamuel mikesamuel closed this Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants