Opened 6 years ago
Last modified 3 years ago
#45168 new defect (bug)
Additional CSS complains of markup inside CSS comments
Reported by: | useStrict | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Customize | Keywords: | needs-patch |
Focuses: | Cc: |
Description
When adding CSS to a site via Appearance > Customize > Additional CSS, the syntax validator will complain if it finds markup regardless of it being inside a /* */ comment.
Steps to replicate:
- Go to Admin > Appearance > Customize > Additional CSS
- Add a comment with some markup in it
/* this is <a> markup test */
- Hit Publish
- See attached error message - but note that no indicator as to what line contains the markup appears.
The only workaround is to remove the markup from the comment.
Ideally the syntax validator should not care about anything in CSS comment blocks.
Attachments (1)
Change History (5)
#2
@
5 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 4.9.8 to 4.7
#3
@
4 years ago
Most of the PHP validation for Additional CSS was replaced in [41376], but the check for the existence of an HTML tag (pattern) is still there.
https://core.trac.wordpress.org/browser/tags/5.5/src/wp-includes/customize/class-wp-customize-custom-css-setting.php#L162
If keeping the tag check in PHP, it would need to make sure all matches to that pattern are not inside comments to pass the validation.
Technically, though, there are workarounds. Currently acceptable methods include adding a space after the first angle bracket or replacing the angle brackets with Markdown-style inline code syntax.
/* comment with < a > tag */ /* comment with `a` tag */
Error message regarding markup inside CSS comment