diff --git a/src/calibre/srv/render_book.py b/src/calibre/srv/render_book.py index a1e12171ff..488e6d41da 100644 --- a/src/calibre/srv/render_book.py +++ b/src/calibre/srv/render_book.py @@ -432,7 +432,7 @@ def transform_inline_styles(container, name, transform_sheet, transform_style): def transform_html(container, name, virtualize_resources, link_uid, link_to_map, virtualized_names): - link_xpath = XPath('//h:a[@href]') + link_xpath = XPath('//h:*[@href and (self::h:a or self::h:area)]') svg_link_xpath = XPath('//svg:a') img_xpath = XPath('//h:img[@src]') svg_img_xpath = XPath('//svg:image[@xl:href]') @@ -604,7 +604,7 @@ def worker_main(): def virtualize_html(container, name, link_uid, link_to_map, virtualized_names): changed = set() - link_xpath = XPath('//h:a[@href]') + link_xpath = XPath('//h:*[@href and (self::h:a or self::h:area)]') svg_link_xpath = XPath('//svg:a') link_replacer = create_link_replacer(container, link_uid, changed) diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index 4bd699d854..526ba30dca 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -691,7 +691,7 @@ class IframeBoss: self.comm.send_message(action, data) def connect_links(self): - for a in document.body.querySelectorAll(f'a[{self.link_attr}]'): + for a in document.body.querySelectorAll(f'a[{self.link_attr}],area[{self.link_attr}]'): a.addEventListener('click', self.link_activated) if runtime.is_standalone_viewer: # links with a target get turned into requests to open a new window by Qt