-
Notifications
You must be signed in to change notification settings - Fork 0
HTML API: Docs fixes #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e2ca83d
10fa6c9
cedb241
40af083
ef2f483
4db0be7
e292a93
91414a6
1ce6d3f
abfbfa0
7a14a38
50cd2f2
3d93924
b1e6c4a
98baee0
685c767
220bef0
e0a0e97
41f520b
ceebce8
96d81fe
5a35fcf
8b6b3e9
bc2ac1b
2861d93
d749176
e10db88
cbd9b41
7ffb517
3b7debd
e65f38b
9d9494b
f3cab0d
251ace2
af2c0dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -213,7 +213,7 @@ | |
| * | ||
| * ### Bookmarks | ||
| * | ||
| * While scanning through the input HTMl document it's possible to set | ||
| * While scanning through the input HTML document it's possible to set | ||
| * a named bookmark when a particular tag is found. Later on, after | ||
| * continuing to scan other tags, it's possible to `seek` to one of | ||
| * the set bookmarks and then proceed again from that point forward. | ||
|
|
@@ -286,7 +286,7 @@ | |
| * | ||
| * For these elements the Tag Processor treats the entire sequence as one, | ||
| * from the opening tag, including its contents, through its closing tag. | ||
| * This means that the it's not possible to match the closing tag for a | ||
| * This means that it's not possible to match the closing tag for a | ||
| * SCRIPT element unless it's unexpected; the Tag Processor already matched | ||
| * it when it found the opening tag. | ||
| * | ||
|
|
@@ -298,7 +298,7 @@ | |
| * closing the SCRIPT from inside a JavaScript string. E.g. `console.log( '</script>' )`. | ||
| * - `TITLE` and `TEXTAREA` whose contents are treated as plaintext and then any | ||
| * character references are decoded. E.g. `1 < 2 < 3` becomes `1 < 2 < 3`. | ||
| * - `IFRAME`, `NOSCRIPT`, `NOEMBED`, `NOFRAME`, `STYLE` whose contents are treated as | ||
| * - `IFRAME`, `NOEMBED`, `NOFRAMES`, `STYLE` whose contents are treated as | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additional scrutiny.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed:
|
||
| * raw plaintext and left as-is. E.g. `1 < 2 < 3` remains `1 < 2 < 3`. | ||
| * | ||
| * #### Other tokens with modifiable text. | ||
|
|
@@ -329,7 +329,7 @@ | |
| * and disallows "xml" as a name, since it's special. The Tag Processor only recognizes | ||
| * target names with an ASCII-representable subset of characters. It also exhibits the | ||
| * same constraint as with CDATA sections, in that `>` cannot exist within the token | ||
| * since Processing Instructions do no exist within HTML and their syntax transforms | ||
| * since Processing Instructions do not exist within HTML and their syntax transforms | ||
| * into a bogus comment in the DOM. | ||
| * | ||
| * ## Design and limitations | ||
|
|
@@ -521,7 +521,7 @@ class WP_HTML_Tag_Processor { | |
| * - A TABLE start tag `<table>` implicitly closes any open `P` element. | ||
| * | ||
| * - In `QUIRKS_MODE`: | ||
| * - CSS class and ID selectors match match in an ASCII case-insensitive manner. | ||
| * - CSS class and ID selectors match in an ASCII case-insensitive manner. | ||
| * - A TABLE start tag `<table>` opens a `TABLE` element as a child of a `P` | ||
| * element if one is open. | ||
| * | ||
|
|
@@ -614,12 +614,12 @@ class WP_HTML_Tag_Processor { | |
| * Example: | ||
| * | ||
| * <div id="test">... | ||
| * 012345678901234 | ||
| * - token length is 14 - 0 = 14 | ||
| * 0123456789012345 | ||
| * - token length is 15 - 0 = 15 | ||
| * | ||
| * a <!-- comment --> is a token. | ||
| * 0123456789 123456789 123456789 | ||
| * - token length is 17 - 2 = 15 | ||
| * - token length is 18 - 2 = 16 | ||
|
Comment on lines
+617
to
+622
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs scrutiny.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems correct. The lengths do seem to correspond with the actual lengths. |
||
| * | ||
| * @since 6.5.0 | ||
| * | ||
|
|
@@ -926,8 +926,6 @@ public function next_tag( $query = null ): bool { | |
| * - a DOCTYPE declaration. | ||
| * - a processing instruction, e.g. `<?xml version="1.0" ?>`. | ||
| * | ||
| * The Tag Processor currently only supports the tag token. | ||
| * | ||
| * @since 6.5.0 | ||
| * @since 6.7.0 Recognizes CDATA sections within foreign content. | ||
| * | ||
|
|
@@ -1073,7 +1071,7 @@ private function base_class_next_token(): bool { | |
| * | ||
| * Preserve the opening tag pointers, as these will be overwritten | ||
| * when finding the closing tag. They will be reset after finding | ||
| * the closing to tag to point to the opening of the special atomic | ||
| * the closing tag to point to the opening of the special atomic | ||
| * tag sequence. | ||
| */ | ||
| $tag_name_starts_at = $this->tag_name_starts_at; | ||
|
|
@@ -1149,7 +1147,7 @@ private function base_class_next_token(): bool { | |
| * Example: | ||
| * | ||
| * $processor = new WP_HTML_Tag_Processor( '<input type="text" value="Th' ); | ||
| * false === $processor->get_next_tag(); | ||
| * false === $processor->next_tag(); | ||
| * true === $processor->paused_at_incomplete_token(); | ||
| * | ||
| * @since 6.5.0 | ||
|
|
@@ -2525,7 +2523,7 @@ private function apply_attributes_updates( int $shift_this_point ): int { | |
| * replacement must be made before all others which follow it | ||
| * at later string indices in the input document. | ||
| * | ||
| * Sorting avoid making out-of-order replacements which | ||
| * Sorting avoids making out-of-order replacements which | ||
| * can lead to mangled output, partially-duplicated | ||
| * attributes, and overwritten attributes. | ||
| */ | ||
|
|
@@ -3555,9 +3553,9 @@ public function get_full_comment_text(): ?string { | |
| * true === $processor->next_token(); // Text is "Apples & Oranges". | ||
| * false === $processor->subdivide_text_appropriately(); | ||
| * | ||
| * $processor = new WP_HTML_Tag_Processor( " \r\n\tMore" ); | ||
| * true === $processor->next_token(); // Text is " ␉More". | ||
| * true === $processor->subdivide_text_appropriately(); // Text is " ␉". | ||
| * $processor = new WP_HTML_Tag_Processor( "
 \r\n\tMore" ); | ||
| * true === $processor->next_token(); // Text is "␍ ␊␉More". | ||
| * true === $processor->subdivide_text_appropriately(); // Text is "␍ ␊␉". | ||
| * true === $processor->next_token(); // Text is "More". | ||
|
sirreal marked this conversation as resolved.
|
||
| * false === $processor->subdivide_text_appropriately(); | ||
| * | ||
|
|
@@ -4935,7 +4933,7 @@ public function get_doctype_info(): ?WP_HTML_Doctype_Info { | |
| * </2> | ||
| * | ||
| * Funky comments are tag closers with invalid tag names. Note | ||
| * that in HTML these are turn into bogus comments. Nonetheless, | ||
| * that in HTML these are turned into bogus comments. Nonetheless, | ||
| * the Tag Processor recognizes them in a stream of HTML and | ||
| * exposes them for inspection and modification. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
https://make.wordpress.org/core/2024/10/17/updates-to-the-html-api-in-6-7/#a-full-parser-mode-in-the-html-processor