diff --git a/Lib/htmllib.py b/Lib/htmllib.py
index c5c6f09e8b4..b689f9c26be 100644
--- a/Lib/htmllib.py
+++ b/Lib/htmllib.py
@@ -322,6 +322,7 @@ class HTMLParser(SGMLParser):
name = ''
type = ''
for attrname, value in attrs:
+ value = string.strip(value)
if attrname == 'href':
href = value
if attrname == 'name':