8000 Fix test with duplicate attribute values at EOF · html5lib/html5lib-python@9581b91 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9581b91

Browse files
committed
Fix test with duplicate attribute values at EOF
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40876
1 parent 63e1165 commit 9581b91

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/html5lib/tokenizer.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ def beforeAttributeNameState(self):
481481
def attributeNameState(self):
482482
data = self.stream.char()
483483
leavingThisState = True
484+
emitToken = False
484485
if data == u"=":
485486
self.state = self.states["beforeAttributeValue"]
486487
elif data in asciiLetters:
@@ -491,7 +492,7 @@ def attributeNameState(self):
491492
# XXX If we emit here the attributes are converted to a dict
492493
# without being checked and when the code below runs we error
493494
# because data is a dict not a list
494-
pass
495+
emitToken = True
495496
elif data in spaceCharacters:
496497
self.state = self.states["afterAttributeName"]
497498
elif data == u"/":
@@ -500,8 +501,8 @@ def attributeNameState(self):
500501
elif data == EOF:
501502
self.tokenQueue.append({"type": "ParseError", "data":
502503
_("Unexpected end of file in attribute name.")})
503-
self.emitCurrentToken()
504-
leavingThisState = False
504+
self.state = self.states["data"]
505+
emitToken = True
505506
else:
506507
self.currentToken["data"][-1][0] += data
507508
leavingThisState = False
@@ -515,7 +516,7 @@ def attributeNameState(self):
515516
self.tokenQueue.append({"type": "ParseError", "data":
516517
_("Dropped duplicate attribute on tag.")})
517518
# XXX Fix for above XXX
518-
if data == u">":
519+
if emitToken:
519520
self.emitCurrentToken()
520521
return True
521522

0 commit comments

Comments
 (0)
0