2022.2

Table Of Contents
Function Description
"loadjson()"onpage729 LoadsJSONdatafromaURL.Thisisasimplewaytoretrievecontentfromexternalsystems.
"query()"onpage742 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821 Thisfunctionreturnsinformationaboutanimageresource.Itcanalsobeusedtocheckifafileexists.
"translate()"onpage814 Getsthetranslationofasourcetextwithan(optional)context.Itreturnsthemessageas-isifnotranslationis
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373).Thescriptwillbecalledinaloopovertheelementsthatmatchthe
selectorofthescript.Itcanaccesseachmatchedelementdirectlyviathethisobject.Foranexample,
see:"this"onpage781.
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720
Iteratesovertheenumerablepropertiesofanobject,inarbitraryorder.Foreachdistinctproperty,statementscanbeexecuted.
for...of Thefor...ofstatementexecutesaloopthat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 716