File tree 1 file changed +9
-7
lines changed
src/html5lib/treebuilders 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -166,20 +166,22 @@ def reconstructActiveFormattingElements(self):
166
166
167
167
# Step 6
168
168
while entry != Marker and entry not in self .openElements :
169
- # Step 5: let entry be one earlier in the list.
170
169
i -= 1
171
- try :
172
- entry = self .activeFormattingElements [i ]
173
- except :
174
- # Step 4: at this point we need to jump to step 8. By not doing
175
- # i += 1 which is also done in step 7 we achieve that.
170
+ if i < 0 :
171
+ # Step 4: at this point we need to jump to step 8.
172
+ # So we reset the index to 0 and break
173
+ i += 1
176
174
break
175
+ # Step 5: let entry be one earlier in the list.
176
+ entry = self .activeFormattingElements [i ]
177
+
177
178
while True :
178
179
# Step 7
179
180
i += 1
180
181
181
182
# Step 8
182
- clone = self .activeFormattingElements [i ].cloneNode ()
183
+ entry = self .activeFormattingElements [i ]
184
+ clone = entry .cloneNode () #Mainly to get a new copy of the attributes
183
185
184
186
# Step 9
185
187
element = self .insertElement ({"type" :"StartTag" ,
You can’t perform that action at this time.
0 commit comments