|
16 | 16 |
|
17 | 17 | from . import utils
|
18 | 18 | from .constants import (
|
19 |
| - spaceCharacters, asciiUpper2Lower, |
| 19 | + spaceCharacters, |
20 | 20 | specialElements, headingElements, cdataElements, rcdataElements,
|
21 | 21 | tokenTypes, tagTokenTypes,
|
22 | 22 | namespaces,
|
@@ -152,8 +152,7 @@ def isHTMLIntegrationPoint(self, element):
|
152 | 152 | if (element.name == "annotation-xml" and
|
153 | 153 | element.namespace == namespaces["mathml"]):
|
154 | 154 | return ("encoding" in element.attributes and
|
155 |
| - element.attributes["encoding"].translate( |
156 |
| - asciiUpper2Lower) in |
| 155 | + utils.ascii_lowercase(element.attributes["encoding"]) in |
157 | 156 | ("text/html", "application/xhtml+xml"))
|
158 | 157 | else:
|
159 | 158 | return (element.namespace, element.name) in htmlIntegrationPointElements
|
@@ -456,7 +455,7 @@ def processDoctype(self, token):
|
456 | 455 | self.tree.insertDoctype(token)
|
457 | 456 |
|
458 | 457 | if publicId != "":
|
459 |
| - publicId = publicId.translate(asciiUpper2Lower) |
| 458 | + publicId = utils.ascii_lowercase(publicId) |
460 | 459 |
|
461 | 460 | if (not correct or token["name"] != "html" or
|
462 | 461 | publicId.startswith(
|
@@ -1167,7 +1166,7 @@ def startTagInput(self, token):
|
1167 | 1166 | framesetOK = self.parser.framesetOK
|
1168 | 1167 | self.startTagVoidFormatting(token)
|
1169 | 1168 | if ("type" in token["data"] and
|
1170 |
| - token["data"]["type"].translate(asciiUpper2Lower) == "hidden"): |
| 1169 | + utils.ascii_lowercase(token["data"]["type"]) == "hidden"): |
1171 | 1170 | # input type=hidden doesn't change framesetOK
|
1172 | 1171 | self.parser.framesetOK = framesetOK
|
1173 | 1172 |
|
@@ -1729,7 +1728,7 @@ def startTagStyleScript(self, token):
|
1729 | 1728 |
|
1730 | 1729 | def startTagInput(self, token):
|
1731 | 1730 | if ("type" in token["data"] and
|
1732 |
| - token["data"]["type"].translate(asciiUpper2Lower) == "hidden"): |
| 1731 | + utils.ascii_lowercase(token["data"]["type"]) == "hidden"): |
1733 | 1732 | self.parser.parseError("unexpected-hidden-input-in-table")
|
1734 | 1733 | self.tree.insertElement(token)
|
1735 | 1734 | # XXX associate with form
|
@@ -2452,11 +2451,11 @@ def processStartTag(self, token):
|
2452 | 2451 | def processEndTag(self, token):
|
2453 | 2452 | nodeIndex = len(self.tree.openElements) - 1
|
2454 | 2453 | node = self.tree.openElements[-1]
|
2455 |
| - if node.name.translate(asciiUpper2Lower) != token["name"]: |
| 2454 | + if utils.ascii_lowercase(node.name) != token["name"]: |
2456 | 2455 | self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
|
2457 | 2456 |
|
2458 | 2457 | while True:
|
2459 |
| - if node.name.translate(asciiUpper2Lower) == token["name"]: |
| 2458 | + if utils.ascii_lowercase(node.name) == token["name"]: |
2460 | 2459 | # XXX this isn't in the spec but it seems necessary
|
2461 | 2460 | if self.parser.phase == self.parser.phases["inTableText"]:
|
2462 | 2461 | self.parser.phase.flushCharacters()
|
|
0 commit comments