2022.1

Table Of Contents
In a Print context, the Standard scripts in the Scripts pane run once for each section and then
for each Master Page (see "Master Pages" on page537). Next, each processed Master Page is
put behind every page to which it should be applied.
Scripts are NOT executed again for every page.
Finally, Post Pagination Scripts run, in the order in which they appear in the Scripts pane
(see "Post Pagination Scripts" on page970).
Post Pagination Scripts are run in a Print context after the content has been paginated.
Because they can search through the output of all Print sections, and modify Print sections (one
at a time), they may be used to create a Table Of Contents (TOC), as explained in the topic:
"Creating a Table Of Contents" on page972.
Tip
Do you find yourself copy-pasting the same function into every new script? You can avoid
this by defining your function in a Control Script. Control Scripts are executed first, so the
function will then be available in all Standard Scripts and Post Pagination Scripts.
Note
Any JavaScript files included in a section run after the scripts in the Scripts pane.
Selectors in Connect
Selectors are patterns used to select one or more HTML elements. They were originally
developed to be able to define the layout of web pages without touching their content, through
Cascading Style Sheets (CSS). In Connect, since each section in a Connect template is in fact
an HTML file (see "Editing HTML" on page666), the very same selectors can be used in style
sheets (see "Styling templates with CSS files" on page786) and template scripts (see
"Personalizing content" on page830 and "Writing your own scripts" on page918). Using
selectors for scripting can increase the speed with which a template and data are merged; see
"Use an ID or class as selector" on page934.
Standard CSS selectors
Selectors are made up of one or more of the following components:
Page 939