Hi mcdummy,
I'd rather think about providing a different plugin that could automatically remove unmatched classes in xml/xhtml than modifying this one. That's because this plugin is designed to run as safely as possible on as many epubs out there as possible, and in doing so it changes absolutely nothing outside of css files. Adding this feature would open a whole new set of issues and edge cases to be worried about.
If (but that's a big if) I find the time in the next days I'll try to put something together (but if someone else wants to step up, please feel free to do so).
About the other suggestions, I find them interesting, and I'll think about them a bit more, although I'm not totally convinced. These are my thoughts for now.
Just showing the classes unmatched by a selector is already done by the Reports tool as DNSB pointed out.
About merging rulesets, I think that's not impossible, but that's not totally safe either:
Code:
.classA {}
.classB { color: red }
.classA { color: blue }
is not the same as
Code:
.classA { color: blue }
.classB { color: red }
for a tag like <p class="classA classB">.
Quote:
Originally Posted by mcdummy
I further noticed that sometimes classes contain the same instruction several times but with different values, e.g., "text-align: left" followed later by "text-align: right". Since only the last definition will be applied, it would be advantageous to remove the first.
|
True, unless the rendering engine of the epub reader decides that the last property has an invalid value: in that case it will use (probably) the first one.
@hobnail: I'm not sure I understood your last posts: do you have a specific proposal or were you simply backing the request of mcdummy?