Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6464fc4

Browse filesBrowse files
committed
Remove the tokenizer's unused case-converting options
1 parent d8d5bb6 commit 6464fc4
Copy full SHA for 6464fc4

File tree

1 file changed

+4
-11
lines changed
Filter options

1 file changed

+4
-11
lines changed

‎html5lib/tokenizer.py

Copy file name to clipboardExpand all lines: html5lib/tokenizer.py
+4-11Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.