mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-05 05:04:46 +00:00
Support <img> srcset attribute parsing.
This commit is contained in:
parent
6caf654031
commit
4232b69633
3 changed files with 11 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ Fixes:
|
|||
|
||||
Features:
|
||||
- checking: Parse and check HTTP Link: headers.
|
||||
- checking: Support parsing of the <img> srcset attribute.
|
||||
|
||||
|
||||
9.1 "Don Jon" (released 30.3.2014)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ LinkTags = {
|
|||
'html': [u'manifest'], # HTML5
|
||||
'iframe': [u'src', u'longdesc'],
|
||||
'ilayer': [u'background'],
|
||||
'img': [u'src', u'lowsrc', u'longdesc', u'usemap'],
|
||||
'img': [u'src', u'lowsrc', u'longdesc', u'usemap', u'srcset'],
|
||||
'input': [u'src', u'usemap', u'formaction'],
|
||||
'ins': [u'cite'],
|
||||
'isindex': [u'action'],
|
||||
|
|
@ -269,6 +269,10 @@ class LinkFinder (TagFinder):
|
|||
elif attr == u'archive':
|
||||
for url in value.split(u','):
|
||||
self.found_url(url, name, base)
|
||||
elif attr == u'srcset':
|
||||
for img_candidate in value.split(u','):
|
||||
url = img_candidate.split()[0]
|
||||
self.found_url(url, name, base)
|
||||
else:
|
||||
self.found_url(value, name, base)
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,11 @@ class TestLinkparser (unittest.TestCase):
|
|||
url = u" alink "
|
||||
self._test_one_link(content % url, url)
|
||||
|
||||
def test_img_srcset_parsing(self):
|
||||
content = u'<img srcset="%s 1x">'
|
||||
url = u"imagesmall.jpg"
|
||||
self._test_one_link(content % url, url)
|
||||
|
||||
def test_form_parsing(self):
|
||||
# Test <form action> parsing
|
||||
content = u'<form action="%s">'
|
||||
|
|
|
|||
Loading…
Reference in a new issue