code: function(option) {
              var current = this.jsonQ_current,
                  newObj = this.cloneObj(jsonQ()),
                  newCurrent = newObj.jsonQ_current = [],
                  prevPathStr = '',
                  key = option.key,
                  method = option.method;
  
              for (var i = 0, ln = current.length; i < ln; i++) {
                  var pathC = current[i].path,
                      pathStr,
                      outofBound = false,
                      parPath = pathC.concat([]);
  
                  //to run callback to apply top traverse logic
                  if (method == 'parent') {
                      if (parPath.length === 0) {
                          outofBound = true;
                      } else {
                          parPath.pop();
                      }
                  } else {
                      var keyIndex = parPath.lastIndexOf(key);
                      if (keyIndex == -1) {
                          outofBound = true;
                      } else {
                          parPath = parPath.slice(0, keyIndex + 1);
                      }
                  }
  
                  pathStr = JSON.stringify(parPath);
  
                  if (prevPathStr != pathStr && !outofBound) {
                      newCurrent.push({
                          path: parPath
                      });
                  }
  
                  prevPathStr = pathStr;
              }
  
              //set other definition variables
              newObj.length = newCurrent.length;
              //to add selector
              newObj.selector.push({
                  method: method,
                  key: key
              });
  
              return newObj;
          }
docs: search on top level