Skip to content

Commit

Permalink
Editor: Remove WP_DEBUG defined check in wp_tinycolor_hue_to_rgb().
Browse files Browse the repository at this point in the history
The constant `WP_DEBUG` is a default constant that is set within `wp_initial_constants()` when not defined. This means the constant will always be defined, thus making the `defined( 'WP_DEBUG' )` unnecessary.

Removing the `defined()` provides these benefits:
* Makes the code more readable.
* Tiny performance optimization.

References:
* WordPress/gutenberg#45979

Follow-up to [52049].

Props ocean90, spacedmonkey, mamaduka.
See #57527. 

git-svn-id: https://develop.svn.wordpress.org/trunk@55141 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
hellofromtonya committed Jan 25, 2023
1 parent 616f0bc commit ca90afc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wp-includes/block-supports/duotone.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ function wp_get_duotone_filter_svg( $preset ) {

$svg = ob_get_clean();

if ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) {
if ( ! SCRIPT_DEBUG ) {
// Clean up the whitespace.
$svg = preg_replace( "/[\r\n\t ]+/", ' ', $svg );
$svg = str_replace( '> <', '><', $svg );
Expand Down Expand Up @@ -543,7 +543,7 @@ function wp_render_duotone_support( $block_content, $block ) {

// !important is needed because these styles render before global styles,
// and they should be overriding the duotone filters set by global styles.
$filter_style = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG
$filter_style = SCRIPT_DEBUG
? $selector . " {\n\tfilter: " . $filter_property . " !important;\n}\n"
: $selector . '{filter:' . $filter_property . ' !important;}';

Expand Down

0 comments on commit ca90afc

Please sign in to comment.