Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When is the best time to add headers and footers to the DEVICERECT elements of a document?

0
Posted

When is the best time to add headers and footers to the DEVICERECT elements of a document?

0

The page total is not known until all the DEVICERECT elements you need have been created. It might seem, therefore, that you should add the headers and footers after the pages are all created and the page total is known. The problem is that even if DEVICERECT elements are absolutely positioned, adding headers and footers to them after they’ve been created will cause the LAYOUTRECT elements to re-flow the source document, which is somewhat inefficient. The bigger problem, however, is that the onlayoutcomplete event will fire again during the re-flow. Since adding the headers and footers will probably be initiated from the onlayoutcomplete handler (once the contentOverflow property is false), you can end up in an infinite loop if you’re not careful. It’s easy enough to prevent this, but you can also avoid the issue entirely by adding the headers and footers—without the page total—when the DEVICERECT elements are first created. Once all the DEVICERECT elements have been generated and the

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123