Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 11-19-2026, 02:08 AM   #1
byword
Enthusiast
byword began at the beginning.
 
Posts: 39
Karma: 10
Join Date: Apr 2022
Device: Onyx Leaf 3
Issue with the 'Delete Unused Stylesheet Selectors' function

I am reporting a regression that did not occur in version 2.8.1.
When running Delete Unused Stylesheet Selectors, both !important declarations and the + signs in unicode-range are removed from the stylesheet.

This issue is 100% reproducible with the following steps:
OS: Windows 11
Sigil 2.8.6 version
  1. Create an empty EPUB and add a stylesheet.
  2. Copy the following CSS into the stylesheet:
Code:
CSS
@font-face {
  font-family: "sans";
  src: url("../Fonts/KoPubDotum_ProMedium.otf");
  unicode-range: U+3000-301F, U+30FB, U+2026;
}

.test_important {
  margin: 2em 0 2em 0 !important;
}

.test_unused {

}
  1. Apply the class in an HTML file so that .test_important is not deleted:

Code:
<p class="test_important"><br/></p>
  1. Run Tools → Delete Unused Stylesheet Selectors.
  2. Check the CSS file. You will see that both the + signs in unicode-range and !important have been removed:

Code:
@font-face {
  font-family: "sans";
  src: url("../Fonts/KoPubDotum_ProMedium.otf");
  unicode-range: U3000-301F, U30FB, U2026;
}

.test_important {
  margin: 2em 0 2em 0;
}
byword is offline   Reply With Quote
Old 11-19-2026, 08:29 AM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 10,264
Karma: 7640672
Join Date: Nov 2009
Device: many
A simpler way to trigger the bug is just reformat the css.

Part of this bug (the loss of the "+" sign when immediately preceding a number) was just reported and fixed recently in Sigil master. It was caused by how the lexbor tokenizer miss-tokenizes and evaluates a number with a + or - immediately preceding the very first digit. I was able to work around that in our code.

The loss of "!important" is a new bug, I will try to track down and workaround this issue with how lexbor tokenizes as well.

Last edited by KevinH; 11-19-2026 at 08:31 AM.
KevinH is online now   Reply With Quote
Advert
Old 11-19-2026, 10:04 AM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 10,264
Karma: 7640672
Join Date: Nov 2009
Device: many
Thank you for your bug report and concise test case!

As it turns out lexbor does not tokenize the "!important" string at all, they just record the fact it is present on a declaration but that was lost in our structure parser. I have augmented our structure parser to detect and add back in the missing "!important".


This should now be fixed in Sigil master.

See https://github.com/Sigil-Ebook/Sigil...06a94c94b41e2e

This fix will appear in the next release of Sigil.

Last edited by KevinH; 11-19-2026 at 10:08 AM.
KevinH is online now   Reply With Quote
Old 11-19-2026, 09:34 PM   #4
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 55,965
Karma: 182837452
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
If anyone running Windows is interested in testing this fix, a build with this fix added is now downloadable from the link in Downloading Sigil test builds for Windows.

Last edited by DNSB; 11-19-2026 at 09:47 PM.
DNSB is offline   Reply With Quote
Old 11-19-2026, 10:06 PM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 10,264
Karma: 7640672
Join Date: Nov 2009
Device: many
Thank you!
KevinH is online now   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Unused Stylesheet Selectors selects all my styles. jwes Sigil 4 05-29-2025 02:28 PM
"Delete unused stylesheet classes" problems with overloaded styles AlanHK Sigil 82 01-24-2021 12:10 PM
alphabetizing stylesheet, check book, and remove unused styles rjwse@aol.com Calibre 9 01-29-2020 07:48 PM
Cleaning a stylesheet of unused styles roger64 Sigil 49 06-13-2012 06:23 AM


All times are GMT -4. The time now is 10:10 AM.


MobileRead.com is a privately owned, operated and funded community.