2022.2

Table Of Contents
AStringcontainingaCSSselector.Seehttps://www.w3schools.com/cssref/css_selectors.aspforCSS
selectorsandcombinationsofCSSselectors.
Example
Theselectorofthefollowingscriptistr(tablerow),sotheobjectresultscontainsallrowsinthetem-
plate.Thescriptsfiltersallevenrowsfromtheresultsandcolorsthemred.
results.filter(":nth-child(even)").css("background-color", "red");
find()
find(textToFind)
PerformsadeepsearchfortextToFindinthechildrenofeachelement,andreturnsanewresultset
withelementsthatsurroundtheoccurrences.
textToFind
AStringthatcontainsthesearchtext.
Example
Thefollowingpieceofcodeloadsasnippet,thenlooksforplaceholdersusingfind(),andreplacesthem
withatext.
var mysnippet = loadhtml('snippets/snippet.html');
mysnippet.find('@var1@').text('OL Connect 1');
mysnippet.find('@var2@').html('<i>OL Connect 2</i>').css('text-decoration','underline');
results.replaceWith(mysnippet);
get(index)
ReturnstheelementfoundatthesuppliedindexinasetofHTMLelements.
index
Placeoftheelementintheresultset.Theindexstartscountingatzero.
Example
ThisPostPaginationScriptcopiesthepagenumbersoflevel1and2headingsinallPrintsectionsto
thecorrespondingentryinatableofcontents.
var $numbers = query('.number');
merge.context.query("h1, h2").each(function( index ) {
var pageNo = this.info().pageNo;
var entry = $numbers.get( index );
if( entry ) {
entry.text( pageNo );
Page 1221