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

Commit320dbc3

Browse files
committed
Fix issue 126 by making reconstructing active formatting elements always work with positive indicies
1 parent468db49 commit320dbc3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

‎src/html5lib/treebuilders/_base.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,18 @@ def reconstructActiveFormattingElements(self):
157157
return
158158

159159
# Step 2 and step 3: we start with the last element. So i is -1.
160-
i=-1
160+
i=len(self.activeFormattingElements)-1
161161
entry=self.activeFormattingElements[i]
162162
ifentry==Markerorentryinself.openElements:
163163
return
164164

165165
# Step 6
166166
whileentry!=Markerandentrynotinself.openElements:
167-
i-=1
168-
ifi<0:
169-
# Step 4: at this point we need to jump to step 8.
170-
# So we reset the index to 0 and break
171-
i+=1
167+
ifi==0:
168+
#This will be reset to 0 below
169+
i=-1
172170
break
171+
i-=1
173172
# Step 5: let entry be one earlier in the list.
174173
entry=self.activeFormattingElements[i]
175174

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp