HTML API: Docs fixes#36
Conversation
…docblock. Corrects "How many node are" to "How many nodes are" in the @return description.
Corrects "How many node are" to "How many nodes are" in the @return description.
Adds a comma after "erroneously match" so the introductory clause is properly separated from the following independent clause.
…cblock. Adds a comma after "failed" to separate the introductory clause from the following independent clause.
…lock. Adds the missing closing comma around the "like an IMG element" parenthetical phrase.
Adds commas to separate the conditions in the compound conditional describing when an empty string is returned.
…ock. Corrects "HTMl" to "HTML" in the Bookmarks section.
Removes the stray "the" in "This means that the it's not possible".
Corrects "do no exist" to "do not exist" in the Processing Instructions section.
Removes the duplicated "match" in the description of CSS selector matching.
Removes the stray "to" in the special atomic tag handling comment.
Corrects "Sorting avoid" to "Sorting avoids" in WP_HTML_Tag_Processor.
Corrects "are turn into" to "are turned into" in the funky comments description.
…se_tag_name(). Corrects two occurrences of "case-insentivity" to "case-insensitivity" in comments.
Corrects "unpected" to "unexpected" in the assertion message of test_unexpected_closing_tags_are_removed().
Corrects "Deprectated" to "Deprecated" in the inline comment next to BGSOUND.
Corrects two occurrences of "Processing instriction" to "Processing instruction" in the data provider for comment-as-PI tests.
…hen". Corrects two BUTTON-in-scope test docblocks where "what" should have been "that".
Corrects three occurrences of "BLOCKQOUTE" to "BLOCKQUOTE" in assertion messages for LI, DD, and DT closing tests.
Corrects "Compete" to "Complete" in the data provider key for incomplete-HTML seek tests, adjusting alignment to match.
…sages. Corrects two occurrences of "subesequent" to "subsequent" in the assertion messages of the remove_class() test.
Corrects "why" to "when" in the assertion message of a modifiable text transformation test.
There was a problem hiding this comment.
Code Review
This pull request consists entirely of minor typographical and grammatical corrections in the documentation blocks, inline comments, and test assertion messages across the WordPress HTML API codebase and its associated PHPUnit tests. No functional code changes were made. I have no additional feedback to provide.
- Clarify $value_starts_at describes a byte offset, not the value itself - Clarify constructor @param $value_start as a byte offset
- Fix broken class name in decode_text_node() example (WP_HTML_Decode -> WP_HTML_Decoder) - Fix broken class name in decode_attribute() example (WP_HTML_Decode -> WP_HTML_Decoder)
- Correct compatibility-mode alias: quirks mode is `BackCompat`, not `CSS1Compat`.
- set_pop_handler() docblock: "pushed item" -> "popped item" - at() docblock: clarify it returns the node, not the node's name
- Fix stale API: get_next_tag() -> next_tag() in paused_at_incomplete_token() example - Correct token_length arithmetic in $token_length property examples - Remove inaccurate sentence claiming Tag Processor only supports tag tokens in next_token() docblock - Fix broken example in subdivide_text_appropriately():  (DC3, non-whitespace) -> 
 (CR, whitespace) - Remove NOSCRIPT from special raw-text elements list in class docblock (Tag Processor descends into NOSCRIPT) - Fix spelling: NOFRAME -> NOFRAMES in class docblock special-elements list
- Correct @var for $bookmark_name from string to string|null to match nullable property
- Correct should_skip_test() @param names/types to match signature ($test_context_element, $test_name) - Update parse_html5_dat_testfile() @return description to reflect 4-element arrays (line number, context element, HTML, DOM)
- Fix variable name in XSS example (`$p` -> `$processor`) - Correct description of set_attribute escaping (does not call esc_attr)
Brings in 9 docblock correctness/staleness fixes from the docs-review-fix pipeline on top of the writing-quality pass.
| * $processor->next_tag(); | ||
| * $processor->set_attribute('class', '" onclick="alert'); | ||
| * echo $p; | ||
| * echo $processor; |
There was a problem hiding this comment.
This seems to work, although I expected echo $processor->get_updated_html();.
| * 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 |
There was a problem hiding this comment.
This seems correct. The lengths do seem to correspond with the actual lengths.
| * - `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 |
There was a problem hiding this comment.
Confirmed:
NOSCRIPTdoesn't get special handling by the HTML API.- The correct element name is
NOFRAMES(notNOFRAME).
| * isn't UTF-8, first convert the document to UTF-8, then pass in the | ||
| * converted HTML. | ||
| * | ||
| * @since 6.7.0 |
There was a problem hiding this comment.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @gemini-code-assist. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
This PR focuses on improving the clarity and correctness of inline documentation and test descriptions for the HTML API, primarily through spelling/grammar fixes and more accurate PHPDoc wording.
Changes:
- Corrects typos and wording in PHPUnit test messages, labels, and doc comments.
- Clarifies HTML API PHPDoc for accuracy (types, terminology, examples, and behavioral descriptions).
- Updates narrative documentation to better reflect actual escaping/token behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/phpunit/tests/html-api/wpHtmlTagProcessorModifiableText.php | Fixes wording in an assertion message. |
| tests/phpunit/tests/html-api/wpHtmlTagProcessor.php | Corrects example output variable and updates escaping description text. |
| tests/phpunit/tests/html-api/wpHtmlTagProcessor-bookmark.php | Fixes a misspelled data-provider label. |
| tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRulesListElements.php | Fixes “BLOCKQOUTE” typo in test expectation messages. |
| tests/phpunit/tests/html-api/wpHtmlProcessorSemanticRules.php | Fixes “Verifies what when …” phrasing in doc comments. |
| tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php | Improves PHPDoc for helper methods/data parsing descriptions. |
| tests/phpunit/tests/html-api/wpHtmlProcessorComments.php | Fixes “instriction” typo in data-provider labels. |
| tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php | Fixes “Deprectated” typo in an inline comment. |
| tests/phpunit/tests/html-api/wpHtmlProcessor.php | Fixes “case-insentivity” typos in comments. |
| tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.php | Fixes “unpected” typo in an assertion message. |
| src/wp-includes/html-api/class-wp-html-token.php | Corrects PHPDoc type for nullable bookmark name. |
| src/wp-includes/html-api/class-wp-html-tag-processor.php | Corrects multiple documentation typos and refines explanatory examples. |
| src/wp-includes/html-api/class-wp-html-processor.php | Minor doc punctuation/wording improvements; adds missing @since for full-parser factory. |
| src/wp-includes/html-api/class-wp-html-open-elements.php | Fixes doc wording to match actual behavior/return types. |
| src/wp-includes/html-api/class-wp-html-doctype-info.php | Corrects quirks-mode compatMode wording to BackCompat. |
| src/wp-includes/html-api/class-wp-html-decoder.php | Fixes class name in examples (WP_HTML_Decoder). |
| src/wp-includes/html-api/class-wp-html-attribute-token.php | Corrects property/param documentation to reflect byte-offset semantics. |
| src/wp-includes/html-api/class-wp-html-active-formatting-elements.php | Fixes “node” → “nodes” grammar in return doc. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Trac ticket:
Use of AI Tools
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.