|
|
#1 |
|
Enthusiast
![]() 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
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 {
}
Code:
<p class="test_important"><br/></p>
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;
}
|
|
|
|
|
|
#2 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
|
|
|
|
|
#4 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
|
|
|
|
|
#5 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,264
Karma: 7640672
Join Date: Nov 2009
Device: many
|
Thank you!
|
|
|
|
| Advert | |
|
|
![]() |
|
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 |