dist/amd.riotx+riot.js
function parseExpressions(root, mustIncludeRoot) {
      var this$1 = this;

      var expressions = [];

      walkNodes(root, function (dom) {
        var type = dom.nodeType;
        var attr;
        var tagImpl;

        if (!mustIncludeRoot && dom === root) { return }

        // text node
        if (type === 3 && dom.parentNode.tagName !== 'STYLE' && tmpl.hasExpr(dom.nodeValue))
          { expressions.push({dom: dom, expr: dom.nodeValue}); }

        if (type !== 1) { return }

        var isVirtual = dom.tagName === 'VIRTUAL';

        // loop. each does it's own thing (for now)
        if (attr = getAttribute(dom, LOOP_DIRECTIVE)) {
          if(isVirtual) { setAttribute(dom, 'loopVirtual', true); } // ignore here, handled in _each
          expressions.push(_each(dom, this$1, attr));
          return false
        }

        // if-attrs become the new parent. Any following expressions (either on the current
        // element, or below it) become children of this expression.
        if (attr = getAttribute(dom, CONDITIONAL_DIRECTIVE)) {
          expressions.push(createIfDirective(dom, this$1, attr));
          return false
        }

        if (attr = getAttribute(dom, IS_DIRECTIVE)) {
          if (tmpl.hasExpr(attr)) {
            expressions.push({
              isRtag: true,
              expr: attr,
              dom: dom,
              attrs: [].slice.call(dom.attributes)
            });

            return false
          }
        }

        // if this is a tag, stop traversing here.
        // we ignore the root, since parseExpressions is called while we're mounting that root
        tagImpl = get(dom);

        if(isVirtual) {
          if(getAttribute(dom, 'virtualized')) {dom.parentElement.removeChild(dom); } // tag created, remove from dom
          if(!tagImpl && !getAttribute(dom, 'virtualized') && !getAttribute(dom, 'loopVirtual'))  // ok to create virtual tag
            { tagImpl = { tmpl: dom.outerHTML }; }
        }

        if (tagImpl && (dom !== root || mustIncludeRoot)) {
          if(isVirtual) { // handled in update
            if (getAttribute(dom, IS_DIRECTIVE))
              { warn(("Virtual tags shouldn't be used together with the \"" + IS_DIRECTIVE + "\" attribute - https://github.com/riot/riot/issues/2511")); }
            // can not remove attribute like directives
            // so flag for removal after creation to prevent maximum stack error
            setAttribute(dom, 'virtualized', true);
            var tag = createTag(
              {tmpl: dom.outerHTML},
              {root: dom, parent: this$1},
              dom.innerHTML
            );

            expressions.push(tag); // no return, anonymous tag, keep parsing
          } else {
            expressions.push(
              initChild(
                tagImpl,
                {
                  root: dom,
                  parent: this$1
                },
                dom.innerHTML,
                this$1
              )
            );
            return false
          }
        }

        // attribute expressions
        parseAttributes.apply(this$1, [dom, dom.attributes, function (attr, expr) {
          if (!expr) { return }
          expressions.push(expr);
        }]);
      });

      return expressions
    }
function parseExpressions(root, mustIncludeRoot) {
      var this$1 = this;

      var expressions = [];

      walkNodes(root, function (dom) {
        var type = dom.nodeType;
        var attr;
        var tagImpl;

        if (!mustIncludeRoot && dom === root) { return }

        // text node
        if (type === 3 && dom.parentNode.tagName !== 'STYLE' && tmpl.hasExpr(dom.nodeValue))
          { expressions.push({dom: dom, expr: dom.nodeValue}); }

        if (type !== 1) { return }

        var isVirtual = dom.tagName === 'VIRTUAL';

        // loop. each does it's own thing (for now)
        if (attr = getAttribute(dom, LOOP_DIRECTIVE)) {
          if(isVirtual) { setAttribute(dom, 'loopVirtual', true); } // ignore here, handled in _each
          expressions.push(_each(dom, this$1, attr));
          return false
        }

        // if-attrs become the new parent. Any following expressions (either on the current
        // element, or below it) become children of this expression.
        if (attr = getAttribute(dom, CONDITIONAL_DIRECTIVE)) {
          expressions.push(createIfDirective(dom, this$1, attr));
          return false
        }

        if (attr = getAttribute(dom, IS_DIRECTIVE)) {
          if (tmpl.hasExpr(attr)) {
            expressions.push({
              isRtag: true,
              expr: attr,
              dom: dom,
              attrs: [].slice.call(dom.attributes)
            });

            return false
          }
        }

        // if this is a tag, stop traversing here.
        // we ignore the root, since parseExpressions is called while we're mounting that root
        tagImpl = get(dom);

        if(isVirtual) {
          if(getAttribute(dom, 'virtualized')) {dom.parentElement.removeChild(dom); } // tag created, remove from dom
          if(!tagImpl && !getAttribute(dom, 'virtualized') && !getAttribute(dom, 'loopVirtual'))  // ok to create virtual tag
            { tagImpl = { tmpl: dom.outerHTML }; }
        }

        if (tagImpl && (dom !== root || mustIncludeRoot)) {
          if(isVirtual) { // handled in update
            if (getAttribute(dom, IS_DIRECTIVE))
              { warn(("Virtual tags shouldn't be used together with the \"" + IS_DIRECTIVE + "\" attribute - https://github.com/riot/riot/issues/2511")); }
            // can not remove attribute like directives
            // so flag for removal after creation to prevent maximum stack error
            setAttribute(dom, 'virtualized', true);
            var tag = createTag(
              {tmpl: dom.outerHTML},
              {root: dom, parent: this$1},
              dom.innerHTML
            );

            expressions.push(tag); // no return, anonymous tag, keep parsing
          } else {
            expressions.push(
              initChild(
                tagImpl,
                {
                  root: dom,
                  parent: this$1
                },
                dom.innerHTML,
                this$1
              )
            );
            return false
          }
        }

        // attribute expressions
        parseAttributes.apply(this$1, [dom, dom.attributes, function (attr, expr) {
          if (!expr) { return }
          expressions.push(expr);
        }]);
      });

      return expressions
    }
function parseExpressions ( root , mustIncludeRoot ) { var this$1 = this ; var expressions = [ ] ; walkNodes ( root , function ( dom ) { var type = dom . nodeType ; var attr ; var tagImpl ; if ( ! mustIncludeRoot && dom === root ) { return } // text node if ( type === 3 && dom . parentNode . tagName !== 'STYLE' && tmpl . hasExpr ( dom . nodeValue ) ) { expressions . push ( { dom : dom , expr : dom . nodeValue } ) ; } if ( type !== 1 ) { return } var isVirtual = dom . tagName === 'VIRTUAL' ; // loop. each does it's own thing (for now) if ( attr = getAttribute ( dom , LOOP_DIRECTIVE ) ) { if ( isVirtual ) { setAttribute ( dom , 'loopVirtual' , true ) ; } // ignore here, handled in _each expressions . push ( _each ( dom , this$1 , attr ) ) ; return false } // if-attrs become the new parent. Any following expressions (either on the current // element, or below it) become children of this expression. if ( attr = getAttribute ( dom , CONDITIONAL_DIRECTIVE ) ) { expressions . push ( createIfDirective ( dom , this$1 , attr ) ) ; return false } if ( attr = getAttribute ( dom , IS_DIRECTIVE ) ) { if ( tmpl . hasExpr ( attr ) ) { expressions . push ( { isRtag : true , expr : attr , dom : dom , attrs : [ ] . slice . call ( dom . attributes ) } ) ; return false } } // if this is a tag, stop traversing here. // we ignore the root, since parseExpressions is called while we're mounting that root tagImpl = get ( dom ) ; if ( isVirtual ) { if ( getAttribute ( dom , 'virtualized' ) ) { dom . parentElement . removeChild ( dom ) ; } // tag created, remove from dom if ( ! tagImpl && ! getAttribute ( dom , 'virtualized' ) && ! getAttribute ( dom , 'loopVirtual' ) ) // ok to create virtual tag { tagImpl = { tmpl : dom . outerHTML } ; } } if ( tagImpl && ( dom !== root || mustIncludeRoot ) ) { if ( isVirtual ) { // handled in update if ( getAttribute ( dom , IS_DIRECTIVE ) ) { warn ( ( "Virtual tags shouldn't be used together with the \"" + IS_DIRECTIVE + "\" attribute - https://github.com/riot/riot/issues/2511" ) ) ; } // can not remove attribute like directives // so flag for removal after creation to prevent maximum stack error setAttribute ( dom , 'virtualized' , true ) ; var tag = createTag ( { tmpl : dom . outerHTML } , { root : dom , parent : this$1 } , dom . innerHTML ) ; expressions . push ( tag ) ; // no return, anonymous tag, keep parsing } else { expressions . push ( initChild ( tagImpl , { root : dom , parent : this$1 } , dom . innerHTML , this$1 ) ) ; return false } } // attribute expressions parseAttributes . apply ( this$1 , [ dom , dom . attributes , function ( attr , expr ) { if ( ! expr ) { return } expressions . push ( expr ) ; } ] ) ; } ) ; return expressions }
Walk the tag DOM to detect the expressions to evaluate
@this Tag
@param   { HTMLElement } root - root tag where we will start digging the expressions
@param   { Boolean } mustIncludeRoot - flag to decide whether the root must be parsed as well
@returns { Array } all the expressions found
Walk the tag DOM to detect the expressions to evaluate