WordPress/wp-includes/html-api
Bernhard Reiter fd9519e7b2 HTML API: Make non-body fragment creation methods private.
The current implementation of `create_fragment` (and the underlying `create_fragment_at_current_node`) allows passing in a context that might result in a tree that cannot be represented by HTML. For example, a user might use `<p>` as context, and attempt to create a fragment that also consists of a paragraph element, `<p>like this`. This would result in a paragraph node nested inside another -- something that can never result from parsing HTML.

To prevent this, this changeset makes `create_fragment_at_current_node` private and limits `create_fragment` to only `<body>` as context, while a comprehensive solution to allow other contexts is being worked on.

Follow-up to [59444], [59467].
Props jonsurrell, dmsnell, bernhard-reiter.
Fixes #62584.
Built from https://develop.svn.wordpress.org/trunk@59469


git-svn-id: http://core.svn.wordpress.org/trunk@58855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-11-28 14:27:18 +00:00
..
class-wp-html-active-formatting-elements.php HTML API: Add missing tags in IN BODY insertion mode to HTML Processor. 2024-07-22 22:24:15 +00:00
class-wp-html-attribute-token.php HTML API: Track spans of text with (offset, length) instead of (start, end). 2023-12-10 13:19:28 +00:00
class-wp-html-decoder.php HTML API: Add missing `@global` tag on HTML Decoder. 2024-09-02 20:55:14 +00:00
class-wp-html-doctype-info.php HTML API: Parse DOCTYPE tokens and set HTML parser mode accordingly. 2024-08-23 14:55:15 +00:00
class-wp-html-open-elements.php HTML API: Ensure that full processor can seek to earlier bookmarks. 2024-11-12 10:32:17 +00:00
class-wp-html-processor-state.php HTML API: Remove unused processor state context_node property 2024-11-27 09:54:17 +00:00
class-wp-html-processor.php HTML API: Make non-body fragment creation methods private. 2024-11-28 14:27:18 +00:00
class-wp-html-span.php HTML API: Add PHP type annotations. 2024-07-19 23:44:16 +00:00
class-wp-html-stack-event.php HTML API: Add PHP type annotations. 2024-07-19 23:44:16 +00:00
class-wp-html-tag-processor.php HTML API: Recognize all uppercase tag names in tag processor. 2024-11-27 09:57:15 +00:00
class-wp-html-text-replacement.php HTML API: Add PHP type annotations. 2024-07-19 23:44:16 +00:00
class-wp-html-token.php HTML API: Add support for SVG and MathML (Foreign content) 2024-08-08 07:25:15 +00:00
class-wp-html-unsupported-exception.php HTML API: Add context to Unsupported_Exception class for improved debugging. 2024-07-12 22:29:13 +00:00
html5-named-character-references.php Introduce Token Map: An optimized static translation class. 2024-05-23 19:56:08 +00:00