General: Fix HTML for get_calendar()

The <tfoot> element was allowed to precede the <tbody> element in HTML 5. However, that was changed in HTML 5.1 and <tfoot> must now follow <tbody>.

This removes the tfooot and instead uses a nav element for navigation between months.

Fixes: #39763
Props: isabel_brison, Harry Milatz, audrasjb, abhijitrakas, SergeyBiryukov

Built from https://develop.svn.wordpress.org/trunk@47223


git-svn-id: http://core.svn.wordpress.org/trunk@47023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2020-02-09 20:44:04 +00:00
parent 61ce35440c
commit b21985f139
2 changed files with 27 additions and 28 deletions

View File

@ -2167,32 +2167,6 @@ function get_calendar( $initial = true, $echo = true ) {
$calendar_output .= '
</tr>
</thead>
<tfoot>
<tr>';
if ( $previous ) {
$calendar_output .= "\n\t\t" . '<td colspan="3" id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' .
$wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
'</a></td>';
} else {
$calendar_output .= "\n\t\t" . '<td colspan="3" id="prev" class="pad">&nbsp;</td>';
}
$calendar_output .= "\n\t\t" . '<td class="pad">&nbsp;</td>';
if ( $next ) {
$calendar_output .= "\n\t\t" . '<td colspan="3" id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
$wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
' &raquo;</a></td>';
} else {
$calendar_output .= "\n\t\t" . '<td colspan="3" id="next" class="pad">&nbsp;</td>';
}
$calendar_output .= '
</tr>
</tfoot>
<tbody>
<tr>';
@ -2260,7 +2234,32 @@ function get_calendar( $initial = true, $echo = true ) {
if ( 0 != $pad && 7 != $pad ) {
$calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '">&nbsp;</td>';
}
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
$calendar_output .= "\n\t</tr>\n\t</tbody>";
$calendar_output .= "\n\t</table>";
$calendar_output .= '<nav aria-label="' . __( 'Previous and next months' ) . '">';
if ( $previous ) {
$calendar_output .= "\n\t\t" . '<span id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' .
$wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
'</a></span>';
} else {
$calendar_output .= "\n\t\t" . '<span id="prev">&nbsp;</span>';
}
$calendar_output .= "\n\t\t" . '<span class="pad">&nbsp;</span>';
if ( $next ) {
$calendar_output .= "\n\t\t" . '<span id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
$wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
' &raquo;</a></span>';
} else {
$calendar_output .= "\n\t\t" . '<span id="next" class="pad">&nbsp;</span>';
}
$calendar_output .= '
</nav>';
$cache[ $key ] = $calendar_output;
wp_cache_set( 'get_calendar', $cache, 'calendar' );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47222';
$wp_version = '5.4-alpha-47223';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.