SingleFile icon indicating copy to clipboard operation
SingleFile copied to clipboard

Save selection keeps not selected html elements as display: none

Open condemil opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

When I use "Save selection" I see that the saved html file have many html elements with style="display:none !important". I have "remove hidden contents" option enabled. I suppose it's an intended behavior.

Describe the solution you'd like

It would be nice to have an option to save as small html file as possible without other html elements around selected html tag. If it's possible it will be great to avoid saving unused css as well.

Describe alternatives you've considered (optional)

Additional context (optional)

condemil avatar Nov 06 '24 14:11 condemil

It's indeed the intended behavior in order to make sure the stylesheets will continue to work. SingleFile would have to rewrite the CSS selectors in order to make sure the feature you're suggesting would work reliably.

gildas-lormeau avatar Nov 10 '24 22:11 gildas-lormeau

As a start it would be nice to remove all siblings under the html tree and leave only one branch to the selected element. This shouldn't require any stylesheet updates.

condemil avatar Nov 11 '24 06:11 condemil