2022.2

Table Of Contents
Function Description
"loadjson()"onpage1184 LoadsJSONdatafromaURL.Thisisasimplewaytoretrievecontentfromexternalsystems.
"query()"onpage1197 Performsaqueryinthetemplate'scontentsandcreatesanewresultsetcontainingtheHTMLelementsthatmatchthe
givenCSSselector.
"resource()"onpage1278 Thisfunctionreturnsinformationaboutanimageresource.Itcanalsobeusedtocheckifafileexists.
"translate()"onpage1270 Getsthetranslationofasourcetextwithan(optional)context.Itreturnsthemessageas-isifnotranslationis
found.
Loopingoverelements
Iftheselectorofascriptmatchesmorethanoneelementinatemplate,youmaywantthescripttoloop
overthem.
Onewaytodothisisbysettingthescript'sscopesetto"Eachmatchedelement"(see"Settingthe
scopeofascript"onpage813).Thescriptwillbecalledinaloopovertheelementsthatmatchthe
selectorofthescript.Itcanaccesseachmatchedelementdirectlyviathethisobject.Foranexample,
see:"this"onpage1237.
Otherwise,thereareanumberofiteratorfunctionsthatyoucanuse,suchaseach(),for(..in...)
andfor...of.
Examples of iterator functions
Function Description
"each()"below Agenericiteratorfunction,toiterateovertheelementsintheresultset.
"for(...in...)"on
page1174
Iteratesovertheenumerablepropertiesofanobject,inarbitraryorder.Foreachdistinctproperty,statementscanbeexecuted.
for...of Thefor...ofstatementexecutesaloopthatoperatesonasequenceofvaluessourcedfromaniterableobject.SeeMoz-
illa'sdocumentation.
Note: Afor...ofloopcurrentlycannotbeusedincombinationwith'const'.
each()
Agenericiteratorfunction,toiterateovertheelementsinaresultset.
Tip: Insteadofusingtheeach()functiontoloopoveraresultset,youcouldsetthescopeofa
StandardscriptorPostPaginationscriptto"Eachmatchedelement"andaccesseachmatched
Page 1171