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

Commit64e8b0b

Browse files
kovidgoyalgsnedders
authored andcommitted
Handle attributes from multiple body tags
1 parent124e975 commit64e8b0b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

‎html5lib/html5parser.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,9 +1019,7 @@ def startTagBody(self, token):
10191019
assertself.parser.innerHTML
10201020
else:
10211021
self.parser.framesetOK=False
1022-
forattr,valueintoken["data"].items():
1023-
ifattrnotinself.tree.openElements[1].attributes:
1024-
self.tree.openElements[1].attributes[attr]=value
1022+
self.tree.apply_body_attributes(token['data'])
10251023

10261024
defstartTagFrameset(self,token):
10271025
self.parser.parseError("unexpected-start-tag", {"name":"frameset"})

‎html5lib/treebuilders/_base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ def apply_html_attributes(self, attrs):
274274
ifattrnotinself.openElements[0].attributes:
275275
self.openElements[0].attributes[attr]=value
276276

277+
defapply_body_attributes(self,attrs):
278+
forattr,valueinattrs.items():
279+
ifattrnotinself.tree.openElements[1].attributes:
280+
self.tree.openElements[1].attributes[attr]=value
281+
277282
def_getInsertFromTable(self):
278283
returnself._insertFromTable
279284

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp