Micro-optimization

This commit is contained in:
Kovid Goyal 2016-10-09 12:37:12 +05:30
parent d2eb1426b0
commit 1255f81cfd

View File

@ -122,11 +122,11 @@ def iterlinks(root, find_links_in_css=True):
for el in root.iter():
attribs = el.attrib
try:
tag = el.tag
except UnicodeDecodeError:
tag = barename(el.tag).lower()
except Exception:
continue
if tag == XHTML('object'):
if tag == 'object':
codebase = None
# <object> tags have attributes that are relative to
# codebase
@ -152,7 +152,7 @@ def iterlinks(root, find_links_in_css=True):
if not find_links_in_css:
continue
if tag == XHTML('style') and el.text:
if tag == 'style' and el.text:
for match in _css_url_re.finditer(el.text):
yield (el, None, match.group(1), match.start(1))
for match in _css_import_re.finditer(el.text):