Make WordPress Core

Changeset 52188


Ignore:
Timestamp:
11/16/2021 07:40:36 PM (23 months ago)
Author:
hellofromTonya
Message:

Formatting: Add additional support for single and nestable tags in force_balance_tags().

Adds track and wbr support for single tags.

Adds article, aside, details, figure, and section for nestable tags.

Updates tests.

Follow-up to [5805], [21828], [45929].

Props glendaviesnz, costdev, talldanwp, ramonopoly, sergeybiryukov.
Fixes #50225.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r52132 r52188  
    25152515    $newtext   = '';
    25162516    // Known single-entity/self-closing tags.
    2517     $single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source' );
     2517    $single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source', 'track', 'wbr' );
    25182518    // Tags that can be immediately nested within themselves.
    2519     $nestable_tags = array( 'blockquote', 'div', 'object', 'q', 'span' );
     2519    $nestable_tags = array( 'article', 'aside', 'blockquote', 'details', 'div', 'figure', 'object', 'q', 'section', 'span' );
    25202520
    25212521    // WP bug fix for comments - in case you REALLY meant to type '< !--'.
  • trunk/tests/phpunit/tests/formatting/balanceTags.php

    r52010 r52188  
    88    public function nestable_tags() {
    99        return array(
     10            array( 'article' ),
     11            array( 'aside' ),
    1012            array( 'blockquote' ),
     13            array( 'details' ),
    1114            array( 'div' ),
     15            array( 'figure' ),
    1216            array( 'object' ),
    1317            array( 'q' ),
     18            array( 'section' ),
    1419            array( 'span' ),
    1520        );
     
    3540            array( 'param' ),
    3641            array( 'source' ),
     42            array( 'track' ),
     43            array( 'wbr' ),
    3744        );
    3845    }
Note: See TracChangeset for help on using the changeset viewer.