HTML API: Document shorthand usage of the next_tag().

Documents the shorthand usage, i.e. `$this->next_tag( 'img' )`, of `WP_HTML_Tag_Processor::next_tag()`.

Also includes table alignments and formatting adjustments in the class docs.

Follow-up to [55203], [55206].

Props zieladam, poena, dmsnell, costdev, hellofromTonya.
Fixes #57863.
See #57575.
Built from https://develop.svn.wordpress.org/trunk@55477


git-svn-id: http://core.svn.wordpress.org/trunk@55010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2023-03-07 16:48:21 +00:00
parent 741c88b2ef
commit 2257e9b451
2 changed files with 10 additions and 9 deletions

View File

@ -40,7 +40,7 @@
* Example:
* ```php
* $tags = new WP_HTML_Tag_Processor( $html );
* if ( $tags->next_tag( array( 'tag_name' => 'option' ) ) ) {
* if ( $tags->next_tag( 'option' ) ) {
* $tags->set_attribute( 'selected', true );
* }
* ```
@ -58,10 +58,11 @@
* $tags->next_tag();
* ```
*
* | Goal | Query |
* |-----------------------------------------------------------|----------------------------------------------------------------------------|
* | Find any tag. | `$tags->next_tag();` |
* | Goal | Query |
* |-----------------------------------------------------------|---------------------------------------------------------------------------------|
* | Find any tag. | `$tags->next_tag();` |
* | Find next image tag. | `$tags->next_tag( array( 'tag_name' => 'img' ) );` |
* | Find next image tag (without passing the array). | `$tags->next_tag( 'img' );` |
* | Find next tag containing the `fullwidth` CSS class. | `$tags->next_tag( array( 'class_name' => 'fullwidth' ) );` |
* | Find next image tag containing the `fullwidth` CSS class. | `$tags->next_tag( array( 'tag_name' => 'img', 'class_name' => 'fullwidth' ) );` |
*
@ -1610,7 +1611,7 @@ class WP_HTML_Tag_Processor {
* $p->get_attribute( 'enabled' ) === true;
* $p->get_attribute( 'aria-label' ) === null;
*
* $p->next_tag( array() ) === false;
* $p->next_tag() === false;
* $p->get_attribute( 'class' ) === null;
* ```
*
@ -1691,7 +1692,7 @@ class WP_HTML_Tag_Processor {
* $p->next_tag( array( 'class_name' => 'test' ) ) === true;
* $p->get_attribute_names_with_prefix( 'data-' ) === array( 'data-enabled', 'data-test-id' );
*
* $p->next_tag( array() ) === false;
* $p->next_tag() === false;
* $p->get_attribute_names_with_prefix( 'data-' ) === null;
* ```
*
@ -1722,10 +1723,10 @@ class WP_HTML_Tag_Processor {
* Example:
* ```php
* $p = new WP_HTML_Tag_Processor( '<DIV CLASS="test">Test</DIV>' );
* $p->next_tag( array() ) === true;
* $p->next_tag() === true;
* $p->get_tag() === 'DIV';
*
* $p->next_tag( array() ) === false;
* $p->next_tag() === false;
* $p->get_tag() === null;
* ```
*

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-beta4-55476';
$wp_version = '6.2-beta4-55477';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.