RESOLVED FIXED 283428
Web Inspector: Prettifying CSS with an asterisk and a `:not` selector changes the CSS behaviour
https://bugs.webkit.org/show_bug.cgi?id=283428
Summary Web Inspector: Prettifying CSS with an asterisk and a `:not` selector changes...
Alex Chan
Reported 2024-11-20 10:16:25 PST
Created attachment 473298 [details] Screenshot of prettified CSS in the Web Inspector I've found a minified CSS rule which, when prettified in the web inspector, gets CSS with different behaviour. ## Minimal example ## Here's the contents of `index.html`: ```html <link href="style.css" rel="stylesheet"> <body> <p>This text is green</p> <p class="black">This text is not green</p> <p>This text is also green</p> </body> ``` Here's the contents of `style.css`: ```css body>*:not(.black){color:green;} ``` If I open `index.html` in Safari, and then look at the contents of `style.css` in the Web Inspector, it's been prettified to: ``` body > * :not(.black) { color: green; } ``` If I copy this back into `style.css`, the behaviour is different -- the first/third paragraphs are no longer coloured green, and instead coloured black. I expect the CSS shown in the Web Inspector to be equivalent to the CSS in the original file. ## Build date and hardware ## Safari Version 18.0.1 (19619.1.26.111.11, 19619) M2 MacBook Pro running macOS 14.7 (23H124)
Attachments
Screenshot of prettified CSS in the Web Inspector (183.14 KB, image/png)
2024-11-20 10:16 PST, Alex Chan
no flags
Radar WebKit Bug Importer
Comment 1 2024-11-27 10:17:15 PST
Razvan Caliman
Comment 2 2025-05-23 05:57:46 PDT
Thank you for filing this! We've found an earlier report: rdar://71544976
Razvan Caliman
Comment 3 2025-05-26 11:09:27 PDT
EWS
Comment 4 2025-05-27 08:38:28 PDT
Committed 295447@main (4f52c5eb3183): <https://commits.webkit.org/295447@main> Reviewed commits have been landed. Closing PR #45916 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.