#54922 closed defect (bug) (fixed)
Normalizing CSS also catches CSS IDs instead of only URLs
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.9.1 | Priority: | normal |
| Severity: | normal | Version: | 5.9 |
| Component: | Script Loader | Keywords: | has-patch has-unit-tests has-test-info commit fixed-major |
| Focuses: | Cc: |
Description
The function _wp_normalize_relative_css_links which was introduced in WordPress 5.9.0 does not only preg matching urls, it also matches HTML ids.
The CSS property
clip-path: url(#image1);
will be replaced by
clip-path: url(/relative_url/#image1);
The clip path wont work anymore after this replacement.
Change History (13)
This ticket was mentioned in PR #2260 on WordPress/wordpress-develop by costdev.
4 years ago
#3
- Keywords has-patch has-unit-tests added
Trac ticket: https://core.trac.wordpress.org/ticket/54922
#4
@
4 years ago
Thanks @mahype for reporting this.
The above PR looks good to me.
We should also implement str_starts_with on other places for better consistency in a follow-up 6.0 ticket.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
4 years ago
#7
@
4 years ago
- Keywords commit added; needs-testing removed
- Owner set to audrasjb
- Status changed from new to assigned
I tested the proposed PR and it fixes the issue.
Using:
echo _wp_normalize_relative_css_links( 'clip-path: url(#image1);', get_stylesheet_uri() );
Result before patch:
clip-path: url(/552/wordpress-13/wp-content/themes/twentytwenty/#image1);
Result after patch:
clip-path: url(#image1);
The patch was reviewed by @SergeyBiryukov. It passes the unit tests.
Self assigning for commit.
#9
@
4 years ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backport consideration.
4 years ago
#10
Committed in https://core.trac.wordpress.org/changeset/52695
Test Report
Env
Steps to test
echo _wp_normalize_relative_css_links( 'clip-path: url(#image1);', get_stylesheet_uri() );Results
clip-path: url(#image1);clip-path: url(/wordpress-develop/src/wp-content/themes/twentytwentytwo/#image1);