Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

simplify CSS link parsing code in lxml.html

  • Loading branch information...
commit 725c1b0cdf095a27c2ee574d9cd48038203462ec 1 parent df5828d
@scoder scoder authored
Showing with 5 additions and 6 deletions.
  1. +5 −6 src/lxml/html/__init__.py
View
11 src/lxml/html/__init__.py
@@ -416,19 +416,18 @@ def iterlinks(self):
yield (el, 'value', el.get('value'), 0)
if tag == 'style' and el.text:
urls = [
- _unquote_match(match.group(1), match.start(1))
+ # (start_pos, url)
+ _unquote_match(match.group(1), match.start(1))[::-1]
for match in _iter_css_urls(el.text)
] + [
- (match.group(1), match.start(1))
+ (match.start(1), match.group(1))
for match in _iter_css_imports(el.text)
]
if urls:
# sort by start pos to bring both match sets back into order
- urls = [ (start, url) for (url, start) in urls ]
- urls.sort()
- # reverse the list to report correct positions despite
+ # and reverse the list to report correct positions despite
# modifications
- urls.reverse()
+ urls.sort(reverse=True)
for start, url in urls:
yield (el, None, url, start)
if 'style' in attribs:
Please sign in to comment.
Something went wrong with that request. Please try again.