Welcome! » Log In » Create A New Profile

tables being removed

Posted by techypaul 
tables being removed
September 11, 2016 04:55AM

Hello,

<table border="0" cellpadding="0" cellspacing="0" width="650" id="header" align="center">
			<thead>
				<tr>
          <td colspan="3" class="logo">
            <a href="https://blah.com" alt="Blah"><img src="https://blah.com/sites/all/themes/rated/images/blah-logo.png" width="210px" alt="Blah Logo"/></a>
          </td>
				</tr>
			</thead>
		</table>
		<table border="0" cellpadding="10" cellspacing="0" id="content" width="650" align="center">
			<tbody>
				<tr>
					<td colspan="3" class="content">
						<h1>*|TITLE|*</h1>
						<div>
              *|CONTENT|*
            </div>
					</td>
				</tr>
			</tbody>
		</table>
		<table border="0" cellpadding="0" cellspacing="0" width="650" id="footer" align="center">  <caption>
    Cool table
  </caption>
			<tfoot>
				<tr>
					<td colspan="3" class="footer">
					  *|FOOTER|*
					</td>
				</tr>
      </tfoot>
		</table>

I am trying to parse this, and it keeps removing the first and last tables. I have switches the order around and it still removes the same tables. I have also run this on the demo html purifier page using defaults and it still get's removed so I know it is not my settings. Log says:

Error Line 1, Column 0: <table> node removed
Error Line 10, Column 2: id attribute on <table> removed
Error Line 22, Column 2: <table> node removed

Please could anyone advise why this might be happening?

Thanks, Paul.

Re: tables being removed
September 11, 2016 06:13AM

Hi all,

I solved this myself. It appears that the tfoot and thead must be in a table with a tbody (see: http://www.w3schools.com/tags/tag_tfoot.asp). This HTML worked fine everywhere until I ran it through htmlpurifier so I guess it is ok to use in general, but it's not technically valid so htmlpurifier did it's job I guess :)

I've adjusted my HTML to use a single table and it parses ok.

Thanks, Paul.

Author:
Your Email:

Subject:

HTML input is enabled. Make sure you escape all HTML and angled brackets with &lt; and &gt;.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

<pre><![CDATA[
Place code here
]]></pre>

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}

Message: