mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-06 05:19:32 +00:00
HTML Fragment parsing always happens with a context node, which may impact how a fragment of HTML is parsed. HTML Fragment Processors can be instantiated with a `BODY` context node via `WP_HTML_Processor::create_fragment( $html )`. This changeset adds a static method called `create_fragment_at_current_node( string $html_fragment )`. It can only be called when the processor is paused at a `#tag`, with some additional constraints: - The opening and closing tags must appear in the HTML input (no virtual tokens). - No "self-contained" elements are allowed ( `IFRAME`, `SCRIPT`, `TITLE`, etc.). If successful, the method will return a `WP_HTML_Processor` instance whose context is inherited from the node that the method was called from. Props jonsurrell, bernhard-reiter, gziolo. Fixes #62357. Built from https://develop.svn.wordpress.org/trunk@59444 git-svn-id: http://core.svn.wordpress.org/trunk@58830 1a063a9b-81f0-0310-95a4-ce76da25c4cd