diff --git a/src/calibre/gui2/tweak_book/jump_to_class.py b/src/calibre/gui2/tweak_book/jump_to_class.py index 7c9867f50a..675670ac4e 100644 --- a/src/calibre/gui2/tweak_book/jump_to_class.py +++ b/src/calibre/gui2/tweak_book/jump_to_class.py @@ -5,11 +5,11 @@ from contextlib import suppress from typing import List, NamedTuple, Optional, Tuple from css_parser.css import CSSRule -from css_selectors import Select, SelectorError from calibre.ebooks.oeb.parse_utils import barename from calibre.ebooks.oeb.polish.container import get_container from calibre.ebooks.oeb.polish.parsing import parse +from css_selectors import Select, SelectorError class NoMatchingTagFound(KeyError): @@ -116,7 +116,7 @@ def find_first_matching_rule( ) if res is not None: return res._replace(style_tag_address=(int(tag.get(lnum_attr)), ['style'])) - elif tn == 'link' and tag.get('href') and tag.get('rel') == 'stylesheet': + elif tn == 'link' and tag.get('href') and tag.get('rel', '').lower() == 'stylesheet': sname = container.href_to_name(tag.get('href'), html_file_name) try: sheet = container.parsed(sname)