gildas-lormeau / SingleFile

Web Extension for saving a faithful copy of a complete web page in a single HTML file
GNU Affero General Public License v3.0
15.21k stars 996 forks source link

Option "HTML > remove unused attributes" #1565

Open ghost opened 2 weeks ago

ghost commented 2 weeks ago

Describe the bug

  1. There is an option in SingleFile to compress the HTML content, the option is activated by default to remove unnecessary content without changing the appearance of the document, reducing the file size:

image

  1. However, the option does not work on certain pages, keeping several unnecessary attributes in the source code elements, such as:

image2

  1. It seems that in general, custom attributes are not removed, leaving the file unnecessarily larger.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://gemini.google.com/share/1c4c3bc8cb01
  2. Save the page with SingleFile
  3. See the source code with several unnecessary attributes on the elements, just increasing the file size

Expected behavior The page has unnecessary attributes removed, and the file size is smaller.

Environment

gildas-lormeau commented 2 weeks ago

The elements you've highlighted are attributes, not tags. This is why they are not removed. Removing unused attributes is not implemented in SingleFile. I also think it's a bit difficult to implement.