Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Comments: alignment, multiline format, annotation.
  • Loading branch information
hellofromtonya authored Dec 2, 2021
commit 690031166fe2d9b3dec521c844083e91a673412c
18 changes: 10 additions & 8 deletions src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ class WP_Theme_JSON {
* @since 5.8.0
*
* @param array $theme_json A structure that follows the theme.json schema.
* @param string $origin Optional. What source of data this object represents.
* One of 'default', 'theme', or 'custom'. Default 'theme'.
* @param string $origin Optional. What source of data this object represents.
* One of 'default', 'theme', or 'custom'. Default 'theme'.
*/
public function __construct( $theme_json = array(), $origin = 'theme' ) {
if ( ! in_array( $origin, self::VALID_ORIGINS, true ) ) {
Expand Down Expand Up @@ -764,12 +764,14 @@ private function get_block_classes( $style_nodes ) {
}
}

// Reset default browser margin on the root body element.
// We set this on the root selector **before** generating the ruleset
// from the `theme.json`. This is to ensure that if the `theme.json` declares
// `margin` in its `spacing` declaration for the `body` element then these
// user-generated values take precedence in the CSS cascade.
// See: https://github.com/WordPress/gutenberg/issues/36147.
/*
* Reset default browser margin on the root body element.
* This is set on the root selector **before** generating the ruleset
* from the `theme.json`. This is to ensure that if the `theme.json` declares
* `margin` in its `spacing` declaration for the `body` element then these
* user-generated values take precedence in the CSS cascade.
* @link https://github.com/WordPress/gutenberg/issues/36147.
*/
if ( self::ROOT_BLOCK_SELECTOR === $selector ) {
$block_rules .= "body { margin: 0; }\n";
}
Expand Down