WP_HTML_Processor_State
- Since
- 6.4.0
- Source
wp-includes/html-api/class-wp-html-processor-state.php:23
Core class used by the HTML processor during HTML parsing for managing the internal parsing state.
Description
This class is designed for internal use by the HTML processor.
Compatibility
- WordPress
- since 6.4.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 11
$stack_of_template_insertion_modesarray<string>public- The stack of template insertion modes.
$stack_of_open_elementsWP_HTML_Open_Elementspublic- Tracks open elements while scanning HTML.
$active_formatting_elementsWP_HTML_Active_Formatting_Elementspublic- Tracks open formatting elements, used to handle mis-nested formatting element tags.
$current_tokenWP_HTML_Token|nullpublic- Refers to the currently-matched tag, if any.
$insertion_modestringpublic- Tree construction insertion mode.
$context_nodenullpublic- Context node initializing fragment parser, if created as a fragment parser.
$encodingstring|nullpublic- The recognized encoding of the input byte stream.
$encoding_confidencestringpublic- The parser's confidence in the input encoding.
$head_elementWP_HTML_Token|nullpublic- HEAD element pointer.
$form_elementWP_HTML_Token|nullpublic- FORM element pointer.
$frameset_okboolpublic- The frameset-ok flag indicates if a
FRAMESETelement is allowed in the current state.
Methods · 1
- __construct()Constructor - creates a new and empty state value.
Source code
class WP_HTML_Processor_State { /* * Insertion mode constants. * * These constants exist and are named to make it easier to * discover and recognize the supported insertion modes in * the parser. * * Out of all the possible insertion modes, only those * supported by the parser are listed here. As support * is added to the parser for more modes, add them here * following the same naming and value pattern. * * @see https://html.spec.whatwg.org/#the-insertion-mode */ /** * Initial insertion mode for full HTML parser. * * @since 6.4.0 * * @see https://html.spec.whatwg.org/#the-initial-insertion-mode * @see WP_HTML_Processor_State::$insertion_mode * * @var string */ const INSERTION_MODE_INITIAL = 'insertion-mode-initial'; /** * Before HTML insertion mode for full HTML parser. * * @since 6.7.0 * * @see https://html.spec.whatwg.org/#the-before-html-insertion-mode * @see WP_HTML_Processor_State::$insertion_mode * * @var string */ const INSERTION_MODE_BEFORE_HTML = 'insertion-mode-before-html'; /** * Before head insertion mode for full HTML parser. * * @since 6.7.0 * * @see https://html.spec.whatwg.org/#parsing-main-beforehead * @see WP_HTML_Processor_State::$insertion_mode * * @var string */ const INSERTION_MODE_BEFORE_HEAD = 'insertion-mode-before-head'; /** * In head insertion mode for full HTML parser. * * @since 6.7.0 * * @see https://html.spec.whatwg.org/#parsing-main-inhead * @see WP_HTML_Processor_State::$insertion_mode * * @var string */ const INSERTION_MODE_IN_HEAD = 'insertion-mode-in-head'; /** * In head noscript insertion mode for full HTML parser. * * @since 6.7.0 * * @see https://html.spec.whatwg.org/#parsing-main-inheadnoscript * @see WP_HTML_Processor_State::$insertion_mode * * @var string */ const INSERTION_MODE_IN_HEAD_NOSCRIPT = 'insertion-mode-in-head-noscript'; /** * After head insertion mode for full HTML parser. * * @since 6.7.0Changelog
Introduced in 6.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/html-api/class-wp-html-processor-state.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.