HumHub Documentation (unofficial)

HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
in package

Definition for tables. The general idea is to extract out all of the essential bits, and then reconstruct it later.

This is a bit confusing, because the DTDs and the W3C validators seem to disagree on the appropriate definition. The DTD claims:

 (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)

But actually, the HTML4 spec then has this to say:

 The TBODY start tag is always required except when the table
 contains only one table body and no table head or foot sections.
 The TBODY end tag may always be safely omitted.

So the DTD is kind of wrong. The validator is, unfortunately, kind of on crack.

The definition changed again in XHTML1.1; and in my opinion, this formulation makes the most sense.

 caption?, ( col* | colgroup* ), (( thead?, tfoot?, tbody+ ) | ( tr+ ))

Essentially, we have two modes: thead/tfoot/tbody mode, and tr mode. If we encounter a thead, tfoot or tbody, we are placed in the former mode, and we must wrap any stray tr segments with a tbody. But if we don't run into any of them, just have tr tags is OK.

Table of Contents

Properties

$allow_empty  : mixed
Indicates whether or not an empty array of children is okay.
$elements  : mixed
Lookup array of all elements that this definition could possibly allow.
$type  : mixed
Type of child definition, usually right-most part of class name lowercase.

Methods

__construct()  : mixed
getAllowedElements()  : array<string|int, mixed>
Get lookup of tag names that should not close this element automatically.
validateChildren()  : array<string|int, mixed>
Validates nodes according to definition and returns modification.

Properties

$allow_empty

Indicates whether or not an empty array of children is okay.

public mixed $allow_empty = \false
Tags
type

bool

$elements

Lookup array of all elements that this definition could possibly allow.

public mixed $elements = array('tr' => \true, 'tbody' => \true, 'thead' => \true, 'tfoot' => \true, 'caption' => \true, 'colgroup' => \true, 'col' => \true)
Tags
type

array

$type

Type of child definition, usually right-most part of class name lowercase.

public mixed $type = 'table'
Tags
type

string

Methods

__construct()

public __construct() : mixed

getAllowedElements()

Get lookup of tag names that should not close this element automatically.

public getAllowedElements(HTMLPurifier_Config $config) : array<string|int, mixed>

All other elements will do so.

Parameters
$config : HTMLPurifier_Config

HTMLPurifier_Config object

Return values
array<string|int, mixed>

        
On this page

Search results