Make WordPress Core


Ignore:
Timestamp:
11/07/2025 04:27:45 AM (2 months ago)
Author:
westonruter
Message:

Script Loader: Improve hoisted stylesheet ordering (in classic themes) to preserve CSS cascade.

This ensures that on-demand block styles are inserted right after the wp-block-library inline style whereas other stylesheets not related to blocks are appended to the end of the HEAD. This helps ensure the expected cascade is preserved. If no wp-block-library inline style is present, then all styles get appended to the HEAD regardless.

The handling of the CSS placeholder comment added to the wp-block-library inline style is also improved. It is now inserted later to ensure the inline style is printed. Additionally, when the CSS placeholder comment is removed from the wp-block-library inline style, the entire STYLE tag is now removed if there are no styles left (aside from the sourceURL comment).

Lastly, the use of the HTML Tag Processor is significantly improved to leverage WP_HTML_Text_Replacement.

Developed in https://github.com/WordPress/wordpress-develop/pull/10436

Follow-up to [61008].

Props westonruter, peterwilsoncc, dmsnell.
Fixes #64099.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpcompat.xml.dist

    r60800 r61174  
    115115    </rule>
    116116
     117    <!--
     118        Excluded while waiting for PHPCompatibility v10.
     119        See <https://github.com/PHPCompatibility/PHPCompatibility/issues/1481>.
     120    -->
     121    <rule ref="PHPCompatibility.FunctionDeclarations.NewClosure.ThisFoundInStatic">
     122        <exclude-pattern>/src/wp-includes/script-loader\.php$</exclude-pattern>
     123    </rule>
     124
    117125</ruleset>
Note: See TracChangeset for help on using the changeset viewer.