2022.2

Table Of Contents
AStringcontainingaCSSselector.Seehttps://www.w3schools.com/cssref/css_selectors.aspforCSS
selectorsandcombinationsofCSSselectors.
Examples
LookforanelementwithacertainID
Thisscriptsappliesastyleruletothequeriedelements.
query("#test1").css("color", "yellow");
Matched element Matched element after script execution
<pid="test1">foo</p> <pid="test1"style="color:yellow;">foo</p>
Lookforanelementinasnippet
Thefollowingscriptloadsasnippet.Thenitlooksupanelementinasnippetandsetsitstext.Finally,it
replacestheelementsmatchedbythescript'sselectorbythesnippet.
var snippet = loadhtml('snippets/mysnippet.html');
query("#foo", snippet).text("bar");
results.replaceWith(snippet);
query(selector, context)
CreatesanewresultsetcontainingtheHTMLelementsthatmatchthesuppliedCSSselector.Thecon-
text(optional)allowsyoutorestrictthesearchtodescendantsofoneormorecontextelements.
selector
AStringcontainingaCSSselector.Seehttps://www.w3schools.com/cssref/css_selectors.aspforCSS
selectorsandcombinationsofCSSselectors.
context
Aresultset(theresultofanotherquery)oranHTMLstring.Ifthepassedcontextisnotaresultsetor
HTMLstringitwillbecoercedtoaStringandinterpretedasHTML.
Examples
Thisscriptperformsaqueryintheresultsofanotherquery.
var table = query("table");
Page 1198