We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 468db49 commit 320dbc3Copy full SHA for 320dbc3
src/html5lib/treebuilders/_base.py
@@ -157,19 +157,18 @@ def reconstructActiveFormattingElements(self):
157
return
158
159
# Step 2 and step 3: we start with the last element. So i is -1.
160
- i = -1
+ i = len(self.activeFormattingElements) - 1
161
entry = self.activeFormattingElements[i]
162
if entry == Marker or entry in self.openElements:
163
164
165
# Step 6
166
while entry != Marker and entry not in self.openElements:
167
- i -= 1
168
- if i < 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
+ if i == 0:
+ #This will be reset to 0 below
+ i = -1
172
break
+ i -= 1
173
# Step 5: let entry be one earlier in the list.
174
175
0 commit comments