HTMLPurifier 4.4.0
HTMLPurifier_ChildDef_Table Class Reference

Definition for tables. More...

Inheritance diagram for HTMLPurifier_ChildDef_Table:
HTMLPurifier_ChildDef HTMLPurifier_ChildDef

List of all members.

Public Member Functions

 __construct ()
 validateChildren ($tokens_of_children, $config, $context)
 Validates nodes according to definition and returns modification.
 __construct ()
 validateChildren ($tokens_of_children, $config, $context)
 Validates nodes according to definition and returns modification.

Public Attributes

 $allow_empty = false
 Bool that indicates whether or not an empty array of children is okay.
 $type = 'table'
 Type of child definition, usually right-most part of class name lowercase.
 $elements
 Lookup array of all elements that this definition could possibly allow.

Detailed Description

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.

Definition at line 32 of file Table.php.


Constructor & Destructor Documentation

HTMLPurifier_ChildDef_Table::__construct ( )

Definition at line 38 of file Table.php.

HTMLPurifier_ChildDef_Table::__construct ( )

Definition at line 11856 of file HTMLPurifier.standalone.php.


Member Function Documentation

HTMLPurifier_ChildDef_Table::validateChildren ( tokens_of_children,
config,
context 
)

Validates nodes according to definition and returns modification.

Parameters:
$tokens_of_childrenArray of HTMLPurifier_Token
$configHTMLPurifier_Config object
$contextHTMLPurifier_Context object
Returns:
bool true to leave nodes as is
bool false to remove parent node
array of replacement child tokens

Reimplemented from HTMLPurifier_ChildDef.

Definition at line 39 of file Table.php.

HTMLPurifier_ChildDef_Table::validateChildren ( tokens_of_children,
config,
context 
)

Validates nodes according to definition and returns modification.

Parameters:
$tokens_of_childrenArray of HTMLPurifier_Token
$configHTMLPurifier_Config object
$contextHTMLPurifier_Context object
Returns:
bool true to leave nodes as is
bool false to remove parent node
array of replacement child tokens

Reimplemented from HTMLPurifier_ChildDef.

Definition at line 11857 of file HTMLPurifier.standalone.php.


Member Data Documentation

HTMLPurifier_ChildDef_Table::$allow_empty = false

Bool that indicates whether or not an empty array of children is okay.

This is necessary for redundant checking when changes affecting a child node may cause a parent node to now be disallowed.

Reimplemented from HTMLPurifier_ChildDef.

Definition at line 34 of file Table.php.

HTMLPurifier_ChildDef_Table::$elements
Initial value:
 array('tr' => true, 'tbody' => true, 'thead' => true,
        'tfoot' => true, 'caption' => true, 'colgroup' => true, 'col' => true)

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

Reimplemented from HTMLPurifier_ChildDef.

Definition at line 36 of file Table.php.

HTMLPurifier_ChildDef_Table::$type = 'table'

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

Used occasionally in terms of context.

Reimplemented from HTMLPurifier_ChildDef.

Definition at line 35 of file Table.php.


The documentation for this class was generated from the following files: