Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit77ee77d

Browse files
committed
Fix handling of </form> in in body and null publicId / systemId in doctypes
--HG--extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401137
1 parent9f8929b commit77ee77d

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

‎src/html5lib/html5parser.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,20 @@ def processComment(self, data):
314314

315315
defprocessDoctype(self,name,publicId,systemId,correct):
316316
nameLower=name.translate(asciiUpper2Lower)
317-
ifnameLower!="html"orpublicId!=Noneor\
318-
systemId!=None:
317+
if(nameLower!="html"orpublicId!=Noneor
318+
systemId!=None):
319319
self.parser.parseError("unknown-doctype")
320-
# XXX need to update DOCTYPE tokens
321-
self.tree.insertDoctype(name,publicId,systemId)
322320

323-
ifpublicId==None:
324-
publicId=""
321+
ifpublicIdisNone:
322+
publicId=""
323+
ifsystemIdisNone:
324+
systemId=""
325+
326+
self.tree.insertDoctype(name,publicId,systemId)
327+
325328
ifpublicId!="":
326-
publicId=publicId.translate(asciiUpper2Lower)
329+
publicId=publicId.translate(asciiUpper2Lower)
330+
327331

328332
if (notcorrect)ornameLower!="html"\
329333
orpublicIdin\
@@ -1064,14 +1068,18 @@ def endTagBlock(self, name):
10641068
node=self.tree.openElements.pop()
10651069

10661070
defendTagForm(self,name):
1067-
ifself.tree.elementInScope(name):
1068-
self.tree.generateImpliedEndTags()
1069-
ifself.tree.openElements[-1].name!=name:
1070-
self.parser.parseError("end-tag-too-early-ignored",
1071-
{"name":"form"})
1072-
else:
1073-
self.tree.openElements.pop()
10741071
self.tree.formPointer=None
1072+
ifnotself.tree.elementInScope(name):
1073+
self.parser.parseError("unexpected-end-tag",
1074+
{"name":"form"})
1075+
else:
1076+
self.tree.generateImpliedEndTags()
1077+
ifself.tree.openElements[-1].name!=name:
1078+
self.parser.parseError("end-tag-too-early-ignored",
1079+
{"name":"form"})
1080+
node=self.tree.openElements.pop()
1081+
whilenode.name!=name:
1082+
node=self.tree.openElements.pop()
10751083

10761084
defendTagListItem(self,name):
10771085
# AT Could merge this with the Block case

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp