Skip to content

Commit a852525

Browse files
committed
Fix handlin of & in unquoted attribute values
1 parent ea5bd60 commit a852525

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/html5lib/tokenizer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ def consumeEntity(self, allowedChar=None, fromAttribute=False):
155155
output = u"&"
156156

157157
charStack = [self.stream.char()]
158-
if charStack[0] in spaceCharacters or charStack[0] in (EOF, u"<", u"&") \
159-
or (allowedChar is not None and allowedChar == charStack[0]):
158+
if (charStack[0] in spaceCharacters or charStack[0] in (EOF, u"<", u"&")
159+
or (allowedChar is not None and allowedChar == charStack[0])):
160160
self.stream.unget(charStack[0])
161161

162162
elif charStack[0] == u"#":
@@ -620,10 +620,10 @@ def attributeValueUnQuotedState(self):
620620
if data in spaceCharacters:
621621
self.state = self.beforeAttributeNameState
622622
elif data == u"&":
623-
self.processEntityInAttribute(None)
623+
self.processEntityInAttribute(">")
624624
elif data == u">":
625625
self.emitCurrentToken()
626-
elif data in (u'"', u"'", u"=", u"<"):
626+
elif data in (u'"', u"'", u"=", u"<":
627627
self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
628628
"unexpected-character-in-unquoted-attribute-value"})
629629
self.currentToken["data"][-1][1] += data

0 commit comments

Comments
 (0)