Skip to content

Commit 6464fc4

Browse files
committed
Remove the tokenizer's unused case-converting options
1 parent d8d5bb6 commit 6464fc4

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

html5lib/tokenizer.py

Lines changed: 4 additions & 11 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy