Skip to content

Commit 3da1fdc

Browse files
committed
compatMode wasn't reinitialized between several uses of the same parser. Also changed compatMode values ("no-quirks" to "no quirks" and "limited-quirks" to "limited quirks")
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401122
1 parent e7db409 commit 3da1fdc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/html5lib/html5parser.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, strict = False, tree=simpletree.TreeBuilder,
5454
self.errors = []
5555

5656
# "quirks" / "limited-quirks" / "no-quirks"
57-
self.compatMode = "no-quirks"
57+
self.compatMode = "no quirks"
5858

5959
self.phases = {
6060
"initial": InitialPhase(self, self.tree),
@@ -87,6 +87,7 @@ def _parse(self, stream, innerHTML=False, container="div",
8787
self.tree.reset()
8888
self.firstStartTag = False
8989
self.errors = []
90+
self.compatMode = "no quirks"
9091

9192
self.tokenizer = self.tokenizer_class(stream, encoding=encoding,
9293
parseMeta=parseMeta,
@@ -324,7 +325,7 @@ def processDoctype(self, name, publicId, systemId, correct):
324325
if publicId != "":
325326
publicId = publicId.translate(asciiUpper2Lower)
326327

327-
if not correct or nameLower != "html"\
328+
if (not correct) or nameLower != "html"\
328329
or publicId in\
329330
("+//silmaril//dtd html pro v0r11 19970101//en",
330331
"-//advasoft ltd//dtd html 3.0 aswedit + extensions//en",
@@ -399,15 +400,15 @@ def processDoctype(self, name, publicId, systemId, correct):
399400
("-//w3c//dtd html 4.01 frameset//EN",
400401
"-//w3c//dtd html 4.01 transitional//EN") and systemId == None)\
401402
or (systemId != None and\
402-
systemId == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"):
403+
systemId == "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"):
403404
self.compatMode = "quirks"
404405
elif publicId in\
405406
("-//w3c//dtd xhtml 1.0 frameset//EN",
406407
"-//w3c//dtd xhtml 1.0 transitional//EN")\
407408
or (publicId in\
408409
("-//w3c//dtd html 4.01 frameset//EN",
409410
"-//w3c//dtd html 4.01 transitional//EN") and systemId == None):
410-
self.compatMode = "limited-quirks"
411+
self.compatMode = "limited quirks"
411412

412413
self.parser.phase = self.parser.phases["beforeHtml"]
413414

0 commit comments

Comments
 (0)