Custom CSS: Fix custom css feature selector#11000
Custom CSS: Fix custom css feature selector#11000aaronrobertshaw wants to merge 1 commit intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
This backports the PHP changes from Gutenberg PR WordPress/gutenberg#75799 to support the
cssfeature selector for block custom CSS in Global Styles.Changes:
get_styles_for_block()— When processing custom CSS rules, use the block'scssfeature selector if defined, falling back to the root selector.get_feature_declarations_for_node()— Skip thecsskey when iterating over feature selectors to prevent it being consumed as a regular style property.Testing Instructions
This is an internal API change. No blocks currently define a
selectors.cssproperty, so there is no user-facing change. The new unit tests verify the behavior:All three tests should pass:
test_get_styles_for_block_custom_css_uses_css_feature_selector— Custom CSS uses thecssfeature selector when defined as a string.test_get_styles_for_block_custom_css_falls_back_to_root_selector— Custom CSS falls back to the root selector when nocssfeature selector is defined.test_get_styles_for_block_custom_css_uses_css_feature_selector_object_form— Custom CSS uses thecssfeature selector when defined as an object with arootsubkey.Trac ticket: https://core.trac.wordpress.org/ticket/64695