[Imps] reconstruct the active formatting elements

Anne van Kesteren annevk at opera.com
Fri Dec 22 10:13:31 PST 2006

We implemented the "reconstruct the active formatting elements"  
http://www.whatwg.org/specs/web-apps/current-work/#reconstruct algorithm  
as follows for html5lib:

     def reconstructActiveFormattingElements(self):
         # Step 1 and 2.

         # Step 3 and 4.
         # XXX The specification says "and entry _not_ in" but that doesn't
         # work. This seems to give correct results too...
         while entry != Marker and entry in self.openElements:
             i -= 1
             entry = self.activeFormattingElements[i]

         # Step 5 and onwards

Is there any testcase that could uncover this bug? Or is it a bug in the  
specification? Note that if we change it to "entry not in  
self.openElements" several testcases will no longer pass and exceptions  
will be thrown for trying to access an element not in the list...

Anne van Kesteren

More information about the Implementors mailing list