hyTags
HomeHome DocumentationDocumentation

selection-loop

Iterates over children or descendants of the selected element.
Parameter
Type
Description
children
Selector?
CSS selector to filter child elements (optional)
descendants
Selector?
CSS selector to filter descendant elements (optional)
accumulate
Type?
Type to accumulate from loop iterations (optional)
commands
Commands
Commands to execute for each element
return
void
Void
Test Case:Loop over children
    <div><span></span><span></span></div>
    
    <var-set name="count" type="number">
      <number-new value="0">
    </var-set>
    <selection-loop children="span">
      <var-set name="count" type="number">
        <var-get name="count">
        <number-add value="1">
      </var-set>
    </selection-loop>
    <var-get name="count">
    <assert-equal value="2" type="number">
    
    👆 Try to change something!
  • Test succeeded Test failed