<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[58878] trunk/src/wp-includes: Code Quality: Clarify variable names in dependency classes.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/58878">58878</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/58878","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>peterwilsoncc</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-08-10 22:58:07 +0000 (Sat, 10 Aug 2024)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Code Quality: Clarify variable names in dependency classes.
Renames several variables in the `WP_Scripts` and `WP_Styles` classes to clarify their purpose for developers reading the code.
Props peterwilsoncc, sergeybiryukov.
See <a href="https://core.trac.wordpress.org/ticket/61607">#61607</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpscriptsphp">trunk/src/wp-includes/class-wp-scripts.php</a></li>
<li><a href="#trunksrcwpincludesclasswpstylesphp">trunk/src/wp-includes/class-wp-styles.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswpscriptsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-scripts.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-scripts.php 2024-08-10 04:58:16 UTC (rev 58877)
+++ trunk/src/wp-includes/class-wp-scripts.php 2024-08-10 22:58:07 UTC (rev 58878)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -289,12 +289,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $ver = $ver ? $ver . '&' . $this->args[ $handle ] : $this->args[ $handle ];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $src = $obj->src;
- $strategy = $this->get_eligible_loading_strategy( $handle );
- $intended_strategy = (string) $this->get_data( $handle, 'strategy' );
- $cond_before = '';
- $cond_after = '';
- $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $src = $obj->src;
+ $strategy = $this->get_eligible_loading_strategy( $handle );
+ $intended_strategy = (string) $this->get_data( $handle, 'strategy' );
+ $ie_conditional_prefix = '';
+ $ie_conditional_suffix = '';
+ $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $this->is_delayed_strategy( $intended_strategy ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $intended_strategy = '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -320,8 +320,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $conditional ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $cond_before = "<!--[if {$conditional}]>\n";
- $cond_after = "<![endif]-->\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $ie_conditional_prefix = "<!--[if {$conditional}]>\n";
+ $ie_conditional_suffix = "<![endif]-->\n";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $before_script = $this->get_inline_script_tag( $handle, 'before' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -328,7 +328,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $after_script = $this->get_inline_script_tag( $handle, 'after' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $before_script || $after_script ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $inline_script_tag = $cond_before . $before_script . $after_script . $cond_after;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $inline_script_tag = $ie_conditional_prefix . $before_script . $after_script . $ie_conditional_suffix;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $inline_script_tag = '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -353,10 +353,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $src Script loader source path.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $handle Script handle.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $srce = apply_filters( 'script_loader_src', $src, $handle );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $filtered_src = apply_filters( 'script_loader_src', $src, $handle );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->in_default_dir( $srce )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->in_default_dir( $filtered_src )
</ins><span class="cx" style="display: block; padding: 0 10px"> && ( $before_script || $after_script || $translations_stop_concat || $this->is_delayed_strategy( $strategy ) )
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->do_concat = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -364,7 +364,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Have to print the so-far concatenated scripts right away to maintain the right order.
</span><span class="cx" style="display: block; padding: 0 10px"> _print_scripts();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->reset();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( $this->in_default_dir( $srce ) && ! $conditional ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( $this->in_default_dir( $filtered_src ) && ! $conditional ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->print_code .= $this->print_extra_script( $handle, false );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->concat .= "$handle,";
</span><span class="cx" style="display: block; padding: 0 10px"> $this->concat_version .= "$handle$ver";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -378,13 +378,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $has_conditional_data = $conditional && $this->get_data( $handle, 'data' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_conditional_data ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo $cond_before;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $ie_conditional_prefix;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->print_extra_script( $handle );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_conditional_data ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo $cond_after;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $ie_conditional_suffix;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // A single item may alias a set of items, by having dependencies, but no source.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -425,9 +425,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $intended_strategy ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $attr['data-wp-strategy'] = $intended_strategy;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $tag = $translations . $cond_before . $before_script;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $tag = $translations . $ie_conditional_prefix . $before_script;
</ins><span class="cx" style="display: block; padding: 0 10px"> $tag .= wp_get_script_tag( $attr );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $tag .= $after_script . $cond_after;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $tag .= $after_script . $ie_conditional_suffix;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters the HTML script tag of an enqueued script.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -626,16 +626,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function set_group( $handle, $recursion, $group = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $this->registered[ $handle ]->args ) && 1 === $this->registered[ $handle ]->args ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $grp = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $calculated_group = 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $grp = (int) $this->get_data( $handle, 'group' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $calculated_group = (int) $this->get_data( $handle, 'group' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( false !== $group && $grp > $group ) {
- $grp = $group;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( false !== $group && $calculated_group > $group ) {
+ $calculated_group = $group;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return parent::set_group( $handle, $recursion, $grp );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return parent::set_group( $handle, $recursion, $calculated_group );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -723,7 +723,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool True on success, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function all_deps( $handles, $recursion = false, $group = false ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $r = parent::all_deps( $handles, $recursion, $group );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result = parent::all_deps( $handles, $recursion, $group );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $recursion ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters the list of script dependencies left to print.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -734,7 +734,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $this->to_do = apply_filters( 'print_scripts_array', $this->to_do );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $r;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $result;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -889,10 +889,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string The best eligible loading strategy.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function get_eligible_loading_strategy( $handle ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $intended = (string) $this->get_data( $handle, 'strategy' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $intended_strategy = (string) $this->get_data( $handle, 'strategy' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Bail early if there is no intended strategy.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! $intended ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $intended_strategy ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -900,16 +900,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * If the intended strategy is 'defer', limit the initial list of eligible
</span><span class="cx" style="display: block; padding: 0 10px"> * strategies, since 'async' can fallback to 'defer', but not vice-versa.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $initial = ( 'defer' === $intended ) ? array( 'defer' ) : null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $initial_strategy = ( 'defer' === $intended_strategy ) ? array( 'defer' ) : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $eligible = $this->filter_eligible_strategies( $handle, $initial );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $eligible_strategies = $this->filter_eligible_strategies( $handle, $initial_strategy );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Return early once we know the eligible strategy is blocking.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $eligible ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( empty( $eligible_strategies ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return in_array( 'async', $eligible, true ) ? 'async' : 'defer';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return in_array( 'async', $eligible_strategies, true ) ? 'async' : 'defer';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -917,20 +917,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $handle The script handle.
- * @param string[]|null $eligible Optional. The list of strategies to filter. Default null.
- * @param array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $handle The script handle.
+ * @param string[]|null $eligible_strategies Optional. The list of strategies to filter. Default null.
+ * @param array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string[] A list of eligible loading strategies that could be used.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- private function filter_eligible_strategies( $handle, $eligible = null, $checked = array() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private function filter_eligible_strategies( $handle, $eligible_strategies = null, $checked = array() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // If no strategies are being passed, all strategies are eligible.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( null === $eligible ) {
- $eligible = $this->delayed_strategies;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( null === $eligible_strategies ) {
+ $eligible_strategies = $this->delayed_strategies;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // If this handle was already checked, return early.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $checked[ $handle ] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $eligible;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $eligible_strategies;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Mark this handle as checked.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -938,12 +938,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // If this handle isn't registered, don't filter anything and return.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $this->registered[ $handle ] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $eligible;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $eligible_strategies;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // If the handle is not enqueued, don't filter anything and return.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $this->query( $handle, 'enqueued' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $eligible;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $eligible_strategies;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $is_alias = (bool) ! $this->registered[ $handle ]->src;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -961,7 +961,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // If the intended strategy is 'defer', filter out 'async'.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'defer' === $intended_strategy ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $eligible = array( 'defer' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $eligible_strategies = array( 'defer' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $dependents = $this->get_dependents( $handle );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -969,14 +969,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Recursively filter eligible strategies for dependents.
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $dependents as $dependent ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Bail early once we know the eligible strategy is blocking.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $eligible ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( empty( $eligible_strategies ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return array();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $eligible = $this->filter_eligible_strategies( $dependent, $eligible, $checked );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $eligible_strategies = $this->filter_eligible_strategies( $dependent, $eligible_strategies, $checked );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $eligible;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $eligible_strategies;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpstylesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-styles.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-styles.php 2024-08-10 04:58:16 UTC (rev 58877)
+++ trunk/src/wp-includes/class-wp-styles.php 2024-08-10 22:58:07 UTC (rev 58878)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -165,14 +165,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $ver = $ver ? $ver . '&' . $this->args[ $handle ] : $this->args[ $handle ];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $src = $obj->src;
- $cond_before = '';
- $cond_after = '';
- $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $src = $obj->src;
+ $ie_conditional_prefix = '';
+ $ie_conditional_suffix = '';
+ $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $conditional ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $cond_before = "<!--[if {$conditional}]>\n";
- $cond_after = "<![endif]-->\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $ie_conditional_prefix = "<!--[if {$conditional}]>\n";
+ $ie_conditional_suffix = "<![endif]-->\n";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $inline_style = $this->print_inline_style( $handle, false );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -279,17 +279,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $this->do_concat ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->print_html .= $cond_before;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->print_html .= $ie_conditional_prefix;
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->print_html .= $tag;
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $inline_style_tag ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->print_html .= $inline_style_tag;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->print_html .= $cond_after;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->print_html .= $ie_conditional_suffix;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo $cond_before;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $ie_conditional_prefix;
</ins><span class="cx" style="display: block; padding: 0 10px"> echo $tag;
</span><span class="cx" style="display: block; padding: 0 10px"> $this->print_inline_style( $handle );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo $cond_after;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $ie_conditional_suffix;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -368,7 +368,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool True on success, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function all_deps( $handles, $recursion = false, $group = false ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $r = parent::all_deps( $handles, $recursion, $group );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result = parent::all_deps( $handles, $recursion, $group );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $recursion ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters the array of enqueued styles before processing for output.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -379,7 +379,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $this->to_do = apply_filters( 'print_styles_array', $this->to_do );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $r;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $result;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre>
</div>
</div>
</body>
</html>