SingleFile icon indicating copy to clipboard operation
SingleFile copied to clipboard

Fix support of CSS nesting (Non-transparent backgrounds on some sites were not saved correctly)

Open tglsf opened this issue 1 year ago • 4 comments

Describe the bug Non-transparent backgrounds on some sites were not saved correctly. The screenshot shows the top bar and semi-transparent backgrounds missing, despite enabling hidden elements and scripts in the configuration.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'http://symphonysounds.net/ssreq3/'
  2. Try enabling and disabling the retention of hidden elements and scripts.
  3. Save them.
  4. Check the result.

Screenshots The top is the original website, and the bottom is the saved page (as seen in the URL bar). Image Image

Environment

  • OS: Windows 10 24H2
  • Browser: Firefox
  • Version: 134.0.2 (64 bits)

tglsf avatar Jan 25 '25 17:01 tglsf

Thank you for the detailed report. I confirm I was able to reproduce the issue. This is due to a technical limitation when trying to optimize the stylesheets. I should be able to fix it though. Meanwhile, you can circumvent the issue by disabling the option "Stylesheets > remove unused styles".

gildas-lormeau avatar Jan 27 '25 15:01 gildas-lormeau

Thank you for the detailed report. I confirm I was able to reproduce the issue. This is due to a technical limitation when trying to optimize the stylesheets. I should be able to fix it though. Meanwhile, you can circumvent the issue by disabling the option "Stylesheets > remove unused styles".

Thanks for your reply. I unchecked that option, but the issue remains:

  1. Some white backgrounds are missing. (See the screenshot: the top shows the original page, the bottom shows the saved page.)
  2. Before saving, I unchecked "Block Scripts" in Options -> Network. Opening the saved page makes Firefox use over 20GB of memory, crashing Windows 11.

Screenshots:

Image

Image

tglsf avatar Jan 29 '25 07:01 tglsf

@tglsf Thank you for the feedback. I confirm the issue. I did not notice the missing white background. For the record, this bug is related to this feature which is quite recent: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors/Selectors_and_combinators#creating_complex_selectors_with_css_nesting

gildas-lormeau avatar Feb 08 '25 20:02 gildas-lormeau

For the record, this issue is related to https://github.com/csstree/csstree/issues/268.

It can be reproduced by running the code below which returns body{> section #release {... instead of body{> section#release {... (cf. space between section and #release).

csstree.generate(csstree.parse(`
  body {
    > section#release {
      .release-box { }
    }
  }
`));

gildas-lormeau avatar Feb 08 '25 21:02 gildas-lormeau

This issue is fixed. The fix will be available in the next version of SingleFile.

gildas-lormeau avatar Oct 28 '25 00:10 gildas-lormeau