Make WordPress Core


Ignore:
Timestamp:
06/01/2021 08:07:07 AM (4 years ago)
Author:
youknowriad
Message:

Block Editor: Update packages and backport the latest Gutenberg fixes.

This includes the following fixes:

Props nosolosw, noisysocks.
See #52991.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r51007 r51051  
    611611
    612612    /**
     613     * Function that appends a sub-selector to a existing one.
     614     *
     615     * Given the compounded $selector "h1, h2, h3"
     616     * and the $to_append selector ".some-class" the result will be
     617     * "h1.some-class, h2.some-class, h3.some-class".
     618     *
     619     * @param string $selector Original selector.
     620     * @param string $to_append Selector to append.
     621     *
     622     * @return string
     623     */
     624    private static function append_to_selector( $selector, $to_append ) {
     625        $new_selectors = array();
     626        $selectors     = explode( ',', $selector );
     627        foreach ( $selectors as $sel ) {
     628            $new_selectors[] = $sel . $to_append;
     629        }
     630
     631        return implode( ',', $new_selectors );
     632    }
     633
     634    /**
    613635     * Given a settings array, it returns the generated rulesets
    614636     * for the preset classes.
     
    634656                foreach ( $preset['classes'] as $class ) {
    635657                    $stylesheet .= self::to_ruleset(
    636                         $selector . '.has-' . $value['slug'] . '-' . $class['class_suffix'],
     658                        self::append_to_selector( $selector, '.has-' . $value['slug'] . '-' . $class['class_suffix'] ),
    637659                        array(
    638660                            array(
Note: See TracChangeset for help on using the changeset viewer.