Skip to content

Commit

Permalink
Merge branch 'trunk' into autoload
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Aug 9, 2024
2 parents 2bbc328 + 9f09c57 commit 16fe142
Show file tree
Hide file tree
Showing 17 changed files with 1,345 additions and 480 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"@wordpress/warning": "3.0.1",
"@wordpress/widgets": "4.0.6",
"@wordpress/wordcount": "4.0.1",
"backbone": "1.5.0",
"backbone": "1.6.0",
"clipboard": "2.0.11",
"core-js-url-browser": "3.6.4",
"element-closest": "^3.0.2",
Expand All @@ -167,7 +167,7 @@
"react-is": "18.3.1",
"regenerator-runtime": "0.14.1",
"underscore": "1.13.6",
"whatwg-fetch": "3.6.17",
"whatwg-fetch": "3.6.20",
"wicg-inert": "3.1.2"
},
"scripts": {
Expand Down
38 changes: 18 additions & 20 deletions src/wp-admin/includes/plugin-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,33 @@
*
* The second filter, {@see 'plugins_api'}, allows a plugin to override the WordPress.org
* Plugin Installation API entirely. If `$action` is 'query_plugins' or 'plugin_information',
* an object MUST be passed. If `$action` is 'hot_tags' or 'hot_categories', an array MUST
* be passed.
* an object MUST be passed. If `$action` is 'hot_tags', an array MUST be passed.
*
* Finally, the third filter, {@see 'plugins_api_result'}, makes it possible to filter the
* response object or array, depending on the `$action` type.
*
* Supported arguments per action:
*
* | Argument Name | query_plugins | plugin_information | hot_tags | hot_categories |
* | -------------------- | :-----------: | :----------------: | :------: | :------------: |
* | `$slug` | No | Yes | No | No |
* | `$per_page` | Yes | No | No | No |
* | `$page` | Yes | No | No | No |
* | `$number` | No | No | Yes | Yes |
* | `$search` | Yes | No | No | No |
* | `$tag` | Yes | No | No | No |
* | `$author` | Yes | No | No | No |
* | `$user` | Yes | No | No | No |
* | `$browse` | Yes | No | No | No |
* | `$locale` | Yes | Yes | No | No |
* | `$installed_plugins` | Yes | No | No | No |
* | `$is_ssl` | Yes | Yes | No | No |
* | `$fields` | Yes | Yes | No | No |
* | Argument Name | query_plugins | plugin_information | hot_tags |
* | -------------------- | :-----------: | :----------------: | :------: |
* | `$slug` | No | Yes | No |
* | `$per_page` | Yes | No | No |
* | `$page` | Yes | No | No |
* | `$number` | No | No | Yes |
* | `$search` | Yes | No | No |
* | `$tag` | Yes | No | No |
* | `$author` | Yes | No | No |
* | `$user` | Yes | No | No |
* | `$browse` | Yes | No | No |
* | `$locale` | Yes | Yes | No |
* | `$installed_plugins` | Yes | No | No |
* | `$is_ssl` | Yes | Yes | No |
* | `$fields` | Yes | Yes | No |
*
* @since 2.7.0
*
* @param string $action API action to perform: 'query_plugins', 'plugin_information',
* 'hot_tags' or 'hot_categories'.
* or 'hot_tags'.
* @param array|object $args {
* Optional. Array or object of arguments to serialize for the Plugin Info API.
*
Expand Down Expand Up @@ -91,7 +90,6 @@
* @type bool $banners Whether to return the banner images links. Default false.
* @type bool $icons Whether to return the icon links. Default false.
* @type bool $active_installs Whether to return the number of active installations. Default false.
* @type bool $group Whether to return the assigned group. Default false.
* @type bool $contributors Whether to return the list of contributors. Default false.
* }
* }
Expand Down Expand Up @@ -136,7 +134,7 @@ function plugins_api( $action, $args = array() ) {
* Returning a non-false value will effectively short-circuit the WordPress.org API request.
*
* If `$action` is 'query_plugins' or 'plugin_information', an object MUST be passed.
* If `$action` is 'hot_tags' or 'hot_categories', an array should be passed.
* If `$action` is 'hot_tags', an array should be passed.
*
* @since 2.7.0
*
Expand Down
2 changes: 0 additions & 2 deletions src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -2738,8 +2738,6 @@ private static function get_block_nodes( $theme_json, $selectors = array(), $opt
* @since 6.6.0 Setting a min-height of HTML when root styles have a background gradient or image.
* Updated general global styles specificity to 0-1-0.
* Fixed custom CSS output in block style variations.
* @since 6.6.1 Avoid applying `:root :where()` wrapper to top-level element-only selectors.
* @since 6.6.2 Avoid applying `:root :where()` wrapper to root selectors.
*
* @param array $block_metadata Metadata about the block to get styles for.
*
Expand Down
113 changes: 65 additions & 48 deletions src/wp-includes/html-api/class-wp-html-open-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ public function set_push_handler( Closure $handler ): void {
*
* @param int $nth Retrieve the nth item on the stack, with 1 being
* the top element, 2 being the second, etc...
* @return string|null Name of the node on the stack at the given location,
* or `null` if the location isn't on the stack.
* @return WP_HTML_Token|null Name of the node on the stack at the given location,
* or `null` if the location isn't on the stack.
*/
public function at( int $nth ): ?string {
public function at( int $nth ): ?WP_HTML_Token {
foreach ( $this->walk_down() as $item ) {
if ( 0 === --$nth ) {
return $item->node_name;
return $item;
}
}

Expand Down Expand Up @@ -242,18 +242,22 @@ public function current_node_is( string $identity ): bool {
*/
public function has_element_in_specific_scope( string $tag_name, $termination_list ): bool {
foreach ( $this->walk_up() as $node ) {
if ( $node->node_name === $tag_name ) {
$namespaced_name = 'html' === $node->namespace
? $node->node_name
: "{$node->namespace} {$node->node_name}";

if ( $namespaced_name === $tag_name ) {
return true;
}

if (
'(internal: H1 through H6 - do not use)' === $tag_name &&
in_array( $node->node_name, array( 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' ), true )
in_array( $namespaced_name, array( 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' ), true )
) {
return true;
}

if ( in_array( $node->node_name, $termination_list, true ) ) {
if ( in_array( $namespaced_name, $termination_list, true ) ) {
return false;
}
}
Expand Down Expand Up @@ -288,7 +292,7 @@ public function has_element_in_specific_scope( string $tag_name, $termination_li
* > - SVG title
*
* @since 6.4.0
* @since 6.7.0 Supports all required HTML elements.
* @since 6.7.0 Full support.
*
* @see https://html.spec.whatwg.org/#has-an-element-in-scope
*
Expand All @@ -309,19 +313,16 @@ public function has_element_in_scope( string $tag_name ): bool {
'OBJECT',
'TEMPLATE',

/*
* @todo Support SVG and MathML nodes when support for foreign content is added.
*
* - MathML mi
* - MathML mo
* - MathML mn
* - MathML ms
* - MathML mtext
* - MathML annotation-xml
* - SVG foreignObject
* - SVG desc
* - SVG title
*/
'math MI',
'math MO',
'math MN',
'math MS',
'math MTEXT',
'math ANNOTATION-XML',

'svg FOREIGNOBJECT',
'svg DESC',
'svg TITLE',
)
);
}
Expand Down Expand Up @@ -363,19 +364,16 @@ public function has_element_in_list_item_scope( string $tag_name ): bool {
'TEMPLATE',
'UL',

/*
* @todo Support SVG and MathML nodes when support for foreign content is added.
*
* - MathML mi
* - MathML mo
* - MathML mn
* - MathML ms
* - MathML mtext
* - MathML annotation-xml
* - SVG foreignObject
* - SVG desc
* - SVG title
*/
'math MI',
'math MO',
'math MN',
'math MS',
'math MTEXT',
'math ANNOTATION-XML',

'svg FOREIGNOBJECT',
'svg DESC',
'svg TITLE',
)
);
}
Expand Down Expand Up @@ -413,19 +411,16 @@ public function has_element_in_button_scope( string $tag_name ): bool {
'OBJECT',
'TEMPLATE',

/*
* @todo Support SVG and MathML nodes when support for foreign content is added.
*
* - MathML mi
* - MathML mo
* - MathML mn
* - MathML ms
* - MathML mtext
* - MathML annotation-xml
* - SVG foreignObject
* - SVG desc
* - SVG title
*/
'math MI',
'math MO',
'math MN',
'math MS',
'math MTEXT',
'math ANNOTATION-XML',

'svg FOREIGNOBJECT',
'svg DESC',
'svg TITLE',
)
);
}
Expand Down Expand Up @@ -692,11 +687,15 @@ public function walk_up( ?WP_HTML_Token $above_this_node = null ) {
* @param WP_HTML_Token $item Element that was added to the stack of open elements.
*/
public function after_element_push( WP_HTML_Token $item ): void {
$namespaced_name = 'html' === $item->namespace
? $item->node_name
: "{$item->namespace} {$item->node_name}";

/*
* When adding support for new elements, expand this switch to trap
* cases where the precalculated value needs to change.
*/
switch ( $item->node_name ) {
switch ( $namespaced_name ) {
case 'APPLET':
case 'BUTTON':
case 'CAPTION':
Expand All @@ -707,6 +706,15 @@ public function after_element_push( WP_HTML_Token $item ): void {
case 'MARQUEE':
case 'OBJECT':
case 'TEMPLATE':
case 'math MI':
case 'math MO':
case 'math MN':
case 'math MS':
case 'math MTEXT':
case 'math ANNOTATION-XML':
case 'svg FOREIGNOBJECT':
case 'svg DESC':
case 'svg TITLE':
$this->has_p_in_button_scope = false;
break;

Expand Down Expand Up @@ -750,6 +758,15 @@ public function after_element_pop( WP_HTML_Token $item ): void {
case 'MARQUEE':
case 'OBJECT':
case 'TEMPLATE':
case 'math MI':
case 'math MO':
case 'math MN':
case 'math MS':
case 'math MTEXT':
case 'math ANNOTATION-XML':
case 'svg FOREIGNOBJECT':
case 'svg DESC':
case 'svg TITLE':
$this->has_p_in_button_scope = $this->has_element_in_button_scope( 'P' );
break;
}
Expand Down
12 changes: 0 additions & 12 deletions src/wp-includes/html-api/class-wp-html-processor-state.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,6 @@ class WP_HTML_Processor_State {
*/
const INSERTION_MODE_AFTER_AFTER_FRAMESET = 'insertion-mode-after-after-frameset';

/**
* In foreign content insertion mode for full HTML parser.
*
* @since 6.7.0
*
* @see https://html.spec.whatwg.org/#parsing-main-inforeign
* @see WP_HTML_Processor_State::$insertion_mode
*
* @var string
*/
const INSERTION_MODE_IN_FOREIGN_CONTENT = 'insertion-mode-in-foreign-content';

/**
* No-quirks mode document compatability mode.
*
Expand Down
Loading

0 comments on commit 16fe142

Please sign in to comment.