mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Viewer: Do not wait for loading of <link> tags that are not stylesheets. Fixes #1851814 [Link tag with url results in slow loading](https://bugs.launchpad.net/calibre/+bug/1851814)
This commit is contained in:
parent
84cfccdd18
commit
e94f9fd04a
@ -190,6 +190,16 @@ def apply_attributes(src, elem, ns_map):
|
||||
continue
|
||||
elem.setAttribute(name, a[1])
|
||||
|
||||
|
||||
def is_loadable_link(attributes):
|
||||
for a in attributes:
|
||||
if a[0].toLowerCase() is 'rel' and a[1]:
|
||||
for x in a[1].split(' '):
|
||||
if x.toLowerCase() is 'stylesheet':
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def process_stack(stack, tag_map, ns_map, load_required, onload):
|
||||
while stack.length:
|
||||
node, parent = stack.pop()
|
||||
@ -216,7 +226,7 @@ def process_stack(stack, tag_map, ns_map, load_required, onload):
|
||||
if src.a:
|
||||
for a in src.a:
|
||||
if a[0] is attr:
|
||||
loadable = True
|
||||
loadable = is_loadable_link(src.a) if src.n is 'link' else True
|
||||
break
|
||||
if loadable:
|
||||
load_required.add(tag_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user