]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Bug #921657] Allow '@' in unquoted HTML attributes. Not strictly legal according...
authorAndrew M. Kuchling <amk@amk.ca>
Sat, 5 Jun 2004 15:31:45 +0000 (15:31 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Sat, 5 Jun 2004 15:31:45 +0000 (15:31 +0000)
Lib/HTMLParser.py
Lib/test/test_htmlparser.py

index 733458126b75455e8f6967ba44d8e91276efa7c7..553e8427ccc2b9c4803a1217c27a5b6ee3a15779 100644 (file)
@@ -26,7 +26,7 @@ commentclose = re.compile(r'--\s*>')
 tagfind = re.compile('[a-zA-Z][-.a-zA-Z0-9:_]*')
 attrfind = re.compile(
     r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*'
-    r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~]*))?')
+    r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~@]*))?')
 
 locatestarttagend = re.compile(r"""
   <[a-zA-Z][-.a-zA-Z0-9:_]*          # tag name
index a830ed7736b137018dd748c6eec9d687830b02d9..5b4bd560d0b5dea251361d0c235e30d0986be9f1 100755 (executable)
@@ -204,6 +204,10 @@ DOCTYPE html [
         self._run_check("<e a=rgb(1,2,3)>", [
             ("starttag", "e", [("a", "rgb(1,2,3)")]),
             ])
+       # Regression test for SF bug #921657.
+        self._run_check("<a href=mailto:xyz@example.com>", [
+            ("starttag", "a", [("href", "mailto:xyz@example.com")]),
+            ])
 
     def test_attr_entity_replacement(self):
         self._run_check("""<a b='&amp;&gt;&lt;&quot;&apos;'>""", [