dist/cytoscape.esm.js
function parse(selector) {
  var self = this;
  var remaining = self.inputText = selector;
  var currentQuery = self[0] = newQuery();
  self.length = 1;
  remaining = consumeWhitespace(remaining); // get rid of leading whitespace

  for (;;) {
    var exprInfo = consumeExpr(remaining);

    if (exprInfo.expr == null) {
      warn('The selector `' + selector + '`is invalid');
      return false;
    } else {
      var args = exprInfo.match.slice(1); // let the token populate the selector object in currentQuery

      var ret = exprInfo.expr.populate(self, currentQuery, args);

      if (ret === false) {
        return false; // exit if population failed
      } else if (ret != null) {
        currentQuery = ret; // change the current query to be filled if the expr specifies
      }
    }

    remaining = exprInfo.remaining; // we're done when there's nothing left to parse

    if (remaining.match(/^\s*$/)) {
      break;
    }
  }

  var lastQ = self[self.length - 1];

  if (self.currentSubject != null) {
    lastQ.subject = self.currentSubject;
  }

  lastQ.edgeCount = self.edgeCount;
  lastQ.compoundCount = self.compoundCount;

  for (var i = 0; i < self.length; i++) {
    var q = self[i]; // in future, this could potentially be allowed if there were operator precedence and detection of invalid combinations

    if (q.compoundCount > 0 && q.edgeCount > 0) {
      warn('The selector `' + selector + '` is invalid because it uses both a compound selector and an edge selector');
      return false;
    }

    if (q.edgeCount > 1) {
      warn('The selector `' + selector + '` is invalid because it uses multiple edge selectors');
      return false;
    } else if (q.edgeCount === 1) {
      warn('The selector `' + selector + '` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.');
    }
  }

  return true; // success
}
function parse(selector) {
  var self = this;
  var remaining = self.inputText = selector;
  var currentQuery = self[0] = newQuery();
  self.length = 1;
  remaining = consumeWhitespace(remaining); // get rid of leading whitespace

  for (;;) {
    var exprInfo = consumeExpr(remaining);

    if (exprInfo.expr == null) {
      warn('The selector `' + selector + '`is invalid');
      return false;
    } else {
      var args = exprInfo.match.slice(1); // let the token populate the selector object in currentQuery

      var ret = exprInfo.expr.populate(self, currentQuery, args);

      if (ret === false) {
        return false; // exit if population failed
      } else if (ret != null) {
        currentQuery = ret; // change the current query to be filled if the expr specifies
      }
    }

    remaining = exprInfo.remaining; // we're done when there's nothing left to parse

    if (remaining.match(/^\s*$/)) {
      break;
    }
  }

  var lastQ = self[self.length - 1];

  if (self.currentSubject != null) {
    lastQ.subject = self.currentSubject;
  }

  lastQ.edgeCount = self.edgeCount;
  lastQ.compoundCount = self.compoundCount;

  for (var i = 0; i < self.length; i++) {
    var q = self[i]; // in future, this could potentially be allowed if there were operator precedence and detection of invalid combinations

    if (q.compoundCount > 0 && q.edgeCount > 0) {
      warn('The selector `' + selector + '` is invalid because it uses both a compound selector and an edge selector');
      return false;
    }

    if (q.edgeCount > 1) {
      warn('The selector `' + selector + '` is invalid because it uses multiple edge selectors');
      return false;
    } else if (q.edgeCount === 1) {
      warn('The selector `' + selector + '` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.');
    }
  }

  return true; // success
}
function parse ( selector ) { var self = this ; var remaining = self . inputText = selector ; var currentQuery = self [ 0 ] = newQuery ( ) ; self . length = 1 ; remaining = consumeWhitespace ( remaining ) ; // get rid of leading whitespace for ( ; ; ) { var exprInfo = consumeExpr ( remaining ) ; if ( exprInfo . expr == null ) { warn ( 'The selector `' + selector + '`is invalid' ) ; return false ; } else { var args = exprInfo . match . slice ( 1 ) ; // let the token populate the selector object in currentQuery var ret = exprInfo . expr . populate ( self , currentQuery , args ) ; if ( ret === false ) { return false ; // exit if population failed } else if ( ret != null ) { currentQuery = ret ; // change the current query to be filled if the expr specifies } } remaining = exprInfo . remaining ; // we're done when there's nothing left to parse if ( remaining . match ( / ^\s*$ / ) ) { break ; } } var lastQ = self [ self . length - 1 ] ; if ( self . currentSubject != null ) { lastQ . subject = self . currentSubject ; } lastQ . edgeCount = self . edgeCount ; lastQ . compoundCount = self . compoundCount ; for ( var i = 0 ; i < self . length ; i ++ ) { var q = self [ i ] ; // in future, this could potentially be allowed if there were operator precedence and detection of invalid combinations if ( q . compoundCount > 0 && q . edgeCount > 0 ) { warn ( 'The selector `' + selector + '` is invalid because it uses both a compound selector and an edge selector' ) ; return false ; } if ( q . edgeCount > 1 ) { warn ( 'The selector `' + selector + '` is invalid because it uses multiple edge selectors' ) ; return false ; } else if ( q . edgeCount === 1 ) { warn ( 'The selector `' + selector + '` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.' ) ; } } return true ; // success }
Parse the string and store the parsed representation in the Selector.
@param {string} selector The selector string
@returns `true` if the selector was successfully parsed, `false` otherwise
Parse the string and store the parsed representation in the Selector .