HTMLPurifier 4.4.0
HTMLPurifier_Strategy_FixNesting Class Reference

Takes a well formed list of tokens and fixes their nesting. More...

Inheritance diagram for HTMLPurifier_Strategy_FixNesting:
HTMLPurifier_Strategy HTMLPurifier_Strategy

List of all members.

Public Member Functions

 execute ($tokens, $config, $context)
 Executes the strategy on the tokens.
 execute ($tokens, $config, $context)
 Executes the strategy on the tokens.

Detailed Description

Takes a well formed list of tokens and fixes their nesting.

HTML elements dictate which elements are allowed to be their children, for example, you can't have a p tag in a span tag. Other elements have much more rigorous definitions: tables, for instance, require a specific order for their elements. There are also constraints not expressible by document type definitions, such as the chameleon nature of ins/del tags and global child exclusions.

The first major objective of this strategy is to iterate through all the nodes (not tokens) of the list of tokens and determine whether or not their children conform to the element's definition. If they do not, the child definition may optionally supply an amended list of elements that is valid or require that the entire node be deleted (and the previous node rescanned).

The second objective is to ensure that explicitly excluded elements of an element do not appear in its children. Code that accomplishes this task is pervasive through the strategy, though the two are distinct tasks and could, theoretically, be seperated (although it's not recommended).

Note:
Whether or not unrecognized children are silently dropped or translated into text depends on the child definitions.
Todo:
Enable nodes to be bubbled out of the structure.

HTML elements dictate which elements are allowed to be their children, for example, you can't have a p tag in a span tag. Other elements have much more rigorous definitions: tables, for instance, require a specific order for their elements. There are also constraints not expressible by document type definitions, such as the chameleon nature of ins/del tags and global child exclusions.

The first major objective of this strategy is to iterate through all the nodes (not tokens) of the list of tokens and determine whether or not their children conform to the element's definition. If they do not, the child definition may optionally supply an amended list of elements that is valid or require that the entire node be deleted (and the previous node rescanned).

The second objective is to ensure that explicitly excluded elements of an element do not appear in its children. Code that accomplishes this task is pervasive through the strategy, though the two are distinct tasks and could, theoretically, be seperated (although it's not recommended).

Note:
Whether or not unrecognized children are silently dropped or translated into text depends on the child definitions.
Todo:
Enable nodes to be bubbled out of the structure.

Definition at line 31 of file FixNesting.php.


Member Function Documentation

HTMLPurifier_Strategy_FixNesting::execute ( tokens,
config,
context 
)

Executes the strategy on the tokens.

Parameters:
$tokensArray of HTMLPurifier_Token objects to be operated on.
$configConfiguration options
Returns:
Processed array of token objects.

Reimplemented from HTMLPurifier_Strategy.

Definition at line 34 of file FixNesting.php.

References $config, and $def.

HTMLPurifier_Strategy_FixNesting::execute ( tokens,
config,
context 
)

Executes the strategy on the tokens.

Parameters:
$tokensArray of HTMLPurifier_Token objects to be operated on.
$configConfiguration options
Returns:
Processed array of token objects.

Reimplemented from HTMLPurifier_Strategy.

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

References $config, and $def.


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