Skip to content

HTML API: Docs fixes#36

Closed
sirreal wants to merge 35 commits into
trunkfrom
html-api/docs-fixes
Closed

HTML API: Docs fixes#36
sirreal wants to merge 35 commits into
trunkfrom
html-api/docs-fixes

Conversation

@sirreal
Copy link
Copy Markdown
Owner

@sirreal sirreal commented Jun 1, 2026

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.

sirreal added 22 commits June 1, 2026 12:54
…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.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

sirreal added 7 commits June 1, 2026 17:59
- 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
- Correct bookmark_token() @return: method returns string or throws; never false.
- Add missing @SInCE 6.7.0 to create_full_parser().
- 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
sirreal added 3 commits June 1, 2026 17:59
- 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;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work, although I expected echo $processor->get_updated_html();.

Comment thread src/wp-includes/html-api/class-wp-html-tag-processor.php
Comment on lines +617 to +622
* 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
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs scrutiny.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The 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.

* - `TITLE` and `TEXTAREA` whose contents are treated as plaintext and then any
* character references are decoded. E.g. `1 &lt; 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
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional scrutiny.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed:

  • NOSCRIPT doesn't get special handling by the HTML API.
  • The correct element name is NOFRAMES (not NOFRAME).

* isn't UTF-8, first convert the document to UTF-8, then pass in the
* converted HTML.
*
* @since 6.7.0
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sirreal sirreal requested a review from Copilot June 1, 2026 17:14
@sirreal sirreal marked this pull request as ready for review June 1, 2026 17:14
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

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 props-bot label.

Unlinked Accounts

The 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:

Props jonsurrell.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php Outdated
@sirreal
Copy link
Copy Markdown
Owner Author

sirreal commented Jun 1, 2026

Code review

No 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 👎.

sirreal and others added 2 commits June 1, 2026 21:46
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants