Skip to content

Commit 244a6eb

Browse files
committed
Remove the tokenizer's unused case-converting options
1 parent 8999da0 commit 244a6eb

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

html5lib/tokenizer.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,11 @@ class HTMLTokenizer(object):
3131
Points to HTMLInputStream object.
3232
"""
3333

34-
def __init__(self, stream, encoding=None, useChardet=True,
35-
lowercaseElementName=True, lowercaseAttrName=True, parser=None):
34+
def __init__(self, stream, encoding=None, useChardet=True, parser=None):
3635

3736
self.stream = HTMLInputStream(stream, encoding, True, useChardet)
3837
self.parser = parser
3938

40-
# Perform case conversions?
41-
self.lowercaseElementName = lowercaseElementName
42-
self.lowercaseAttrName = lowercaseAttrName
43-
4439
# Setup the initial tokenizer state
4540
self.escapeFlag = False
4641
self.lastFourChars = []
@@ -232,8 +227,7 @@ def emitCurrentToken(self):
232227
token = self.currentToken
233228
# Add token to the queue to be yielded
234229
if (token["type"] in tagTokenTypes):
235-
if self.lowercaseElementName:
236-
token["name"] = token["name"].translate(asciiUpper2Lower)
230+
token["name"] = token["name"].translate(asciiUpper2Lower)
237231
if token["type"] == tokenTypes["EndTag"]:
238232
if token["data"]:
239233
self.tokenQueue.append({"type": tokenTypes["ParseError"],
@@ -918,9 +912,8 @@ def attributeNameState(self):
918912
# Attributes are not dropped at this stage. That happens when the
919913
# start tag token is emitted so values can still be safely appended
920914
# to attributes, but we do want to report the parse error in time.
921-
if self.lowercaseAttrName:
922-
self.currentToken["data"][-1][0] = (
923-
self.currentToken["data"][-1][0].translate(asciiUpper2Lower))
915+
self.currentToken["data"][-1][0] = (
916+
self.currentToken["data"][-1][0].translate(asciiUpper2Lower))
924917
for name, _ in self.currentToken["data"][:-1]:
925918
if self.currentToken["data"][-1][0] == name:
926919
self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":

0 commit comments

Comments
 (0)