We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentd05574a commit53bf191Copy full SHA for 53bf191
src/html5lib/treebuilders/_base.py
@@ -166,20 +166,22 @@ def reconstructActiveFormattingElements(self):
166
167
# Step 6
168
whileentry!=Markerandentrynotinself.openElements:
169
-# Step 5: let entry be one earlier in the list.
170
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.
+ifi<0:
+# Step 4: at this point we need to jump to step 8.
+# So we reset the index to 0 and break
+i+=1
176
break
+# Step 5: let entry be one earlier in the list.
+entry=self.activeFormattingElements[i]
177
+
178
whileTrue:
179
# Step 7
180
i+=1
181
182
# Step 8
-clone=self.activeFormattingElements[i].cloneNode()
183
184
+clone=entry.cloneNode()#Mainly to get a new copy of the attributes
185
186
# Step 9
187
element=self.insertElement({"type":"StartTag",