Get the related component from a node

@param {ASTNode} node The AST node being checked (must be a MemberExpression).
@returns {ASTNode} component node, null if we cannot find the component
328445
function(node) {
      var i;
      var j;
      var k;
      var l;
      var componentName;
      var componentNode;
      // Get the component path
      var componentPath = [];
      while (node) {
        if (node.property && node.property.type === 'Identifier') {
          componentPath.push(node.property.name);
        }
        if (node.object && node.object.type === 'Identifier') {
          componentPath.push(node.object.name);
        }
        node = node.object;
      }
      componentPath.reverse();
      componentName = componentPath.slice(0, componentPath.length - 1).join('.');

      // Find the variable in the current scope
      var variableName = componentPath.shift();
      if (!variableName) {
        return null;
      }
      var variableInScope;
      var variables = variableUtil.variablesInScope(context);
      for (i = 0, j = variables.length; i < j; i++) {
        if (variables[i].name === variableName) {
          variableInScope = variables[i];
          break;
        }
      }
      if (!variableInScope) {
        return null;
      }

      // Try to find the component using variable references
      var refs = variableInScope.references;
      var refId;
      for (i = 0, j = refs.length; i < j; i++) {
        refId = refs[i].identifier;
        if (refId.parent && refId.parent.type === 'MemberExpression') {
          refId = refId.parent;
        }
        if (sourceCode.getText(refId) !== componentName) {
          continue;
        }
        if (refId.type === 'MemberExpression') {
          componentNode = refId.parent.right;
        } else if (refId.parent && refId.parent.type === 'VariableDeclarator') {
          componentNode = refId.parent.init;
        }
        break;
      }

      if (componentNode) {
        // Return the component
        return components.add(componentNode, 1);
      }

      // Try to find the component using variable declarations
      var defInScope;
      var defs = variableInScope.defs;
      for (i = 0, j = defs.length; i < j; i++) {
        if (defs[i].type === 'ClassName' || defs[i].type === 'FunctionName' || defs[i].type === 'Variable') {
          defInScope = defs[i];
          break;
        }
      }
      if (!defInScope || !defInScope.node) {
        return null;
      }
      componentNode = defInScope.node.init || defInScope.node;

      // Traverse the node properties to the component declaration
      for (i = 0, j = componentPath.length; i < j; i++) {
        if (!componentNode.properties) {
          continue;
        }
        for (k = 0, l = componentNode.properties.length; k < l; k++) {
          if (componentNode.properties[k].key.name === componentPath[i]) {
            componentNode = componentNode.properties[k];
            break;
          }
        }
        if (!componentNode || !componentNode.value) {
          return null;
        }
        componentNode = componentNode.value;
      }

      // Return the component
      return components.add(componentNode, 1);
    }
1283413
function(node, method) {
            node = Y.Dom.get(node);
            if (!node) {
                return null;
            }
            return Y.Dom.getFirstChildBy(node);
        }
772771
function(node) {
    var doc = '';
    var sibling = node.firstChild;
    var serializer = new XMLSerializer();

    while (sibling) {
      if (this.isElementNode(sibling)) {
        doc += serializer.serializeToString(sibling);
      }
      sibling = sibling.nextSibling;
    }

    return doc !== '' ? doc : null;
  }
259578
function(node, method) {
            node = Y.Dom.get(node);
            if (!node) {
                YAHOO.log('getFirstChild failed: invalid node argument', 'error', 'Dom');
                return null;
            }
            return Y.Dom.getFirstChildBy(node);
        }
3108
function(node) {
            node = Y.Dom.get(node);
            if (!node) {
            }

            return Y.Dom.getChildrenBy(node);
        }
455736
private void visitComponentModel(final ObjectGraphNode node) {
		ComponentModel model = (ComponentModel) node.getValue();
		ComponentModel sharedModel = null;

		List<Field> fieldList = ReflectionUtil.getAllFields(node.getValue(), true, false);
		Field[] fields = fieldList.toArray(new Field[fieldList.size()]);

		for (int i = 0; i < fields.length; i++) {
			if (ComponentModel.class.equals(fields[i].getDeclaringClass())
					&& "sharedModel".equals(fields[i].getName())) {
				sharedModel = (ComponentModel) readField(fields[i], model);
			}
		}

		visitComplexTypeWithDiff(node, sharedModel);
	}
202647
function(node) {
			node = node instanceof gui.Spirit ? node.element : node;
			return this.contains(node.ownerDocument, node);
		}
738276
function getSiblingNode(node) {
  while (node) {
    if (node.nextSibling) {
      return node.nextSibling;
    }
    node = node.parentNode;
  }
}
219841
function getInstanceFromNode(node) {
  var inst = node[internalInstanceKey];
  if (inst) {
    if (inst.tag === HostComponent || inst.tag === HostText) {
      return inst;
    } else if (inst._hostNode === node) {
      return inst;
    } else {
      return null;
    }
  }
  inst = getClosestInstanceFromNode(node);
  if (inst != null && inst._hostNode === node) {
    return inst;
  } else {
    return null;
  }
}
61283
function(node) {
            node = Y.Dom.get(node);
            if (!node) {
                YAHOO.log('getChildren failed: invalid node argument', 'error', 'Dom');
            }

            return Y.Dom.getChildrenBy(node);
        }
337418
function propsNode (node) {
  var props = flatmap(Object.keys(node), function (key) {
    if (key == 'type' || key == 'value' || key == 'children') {
      return;
    }

    var value = node[key];

    if (key == 'data') {
      value = JSON.parse(JSON.stringify(value));
    }

    return {
      type: 'Property',
      key: {
        type: 'Identifier',
        name: key
      },
      value: literalNode(value)
    };
  });

  return props.length && {
    type: 'ObjectExpression',
    properties: props
  };
}
1108416
function getTokens(node) {
            const arrow = sourceCode.getTokenBefore(node.body, astUtils.isArrowToken);

            return {
                before: sourceCode.getTokenBefore(arrow),
                arrow,
                after: sourceCode.getTokenAfter(arrow)
            };
        }
829029
function getComponentName(node) {

  // var Hello = React.createClass({ ... });
  if (
    node.parent && node.parent.parent &&
    node.parent.parent.type === 'VariableDeclarator' &&
    node.parent.parent.id.name) {
    return node.parent.parent.id.name;
  }

  // class Hello extends React.Component { }
  if (node.type === 'ClassDeclaration' &&
    node.id.type === 'Identifier' &&
    node.id.name) {
    return node.id.name;
  }

  // var DontLook = function() { return (<div>Hello {this.props.name}</div>); };
  if (
    node.parent && node.parent.id &&
    (node.type === 'FunctionExpression' ||
    node.type === 'ArrowFunctionExpression') &&
    node.id === null &&
    node.parent.type === 'VariableDeclarator' &&
    node.parent.id.type === 'Identifier') {
    return node.parent.id.name;
  }

  // function FolksWolves() { return (<div>Hello {this.props.name}</div>); }
  if (
    node.type === 'FunctionDeclaration' &&
    node.id) {
    return node.id.name;
  }

  return null;
}
149618
function(index, node = this.fch) {
                if(node.par !== this)
                    node = this.fch;

                let first = node;
                let i = 0;
                while (node && node != first) {
                    if (i++ == index)
                        return node;
                    node = node.nxt;
                }

                return null;
            }
1286692
@Nullable
  private static Node getNode(Document doc, String parentNodeName, String targetNodeName) {
    NodeList parentElements = doc.getElementsByTagNameNS(APP_ENGINE_NAMESPACE, parentNodeName);
    if (parentElements.getLength() > 0) {
      Node parent = parentElements.item(0);
      if (parent.hasChildNodes()) {
        for (int i = 0; i < parent.getChildNodes().getLength(); i++) {
          Node child = parent.getChildNodes().item(i);
          if (child.getNodeName().equals(targetNodeName)) {
            return child;
          }
        }
      }
    }
    return null;
  }
774109
function findParent(node) {
  // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  // traversal, but caching is difficult to do correctly without using a
  // mutation observer to listen for all DOM changes.
  var nodeID = ReactMount.getID(node);
  var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
  var container = ReactMount.findReactContainerForID(rootID);
  var parent = ReactMount.getFirstReactDOM(container);
  return parent;
}
482193
function(node) {
    return node.nodeType === this.TEXT_NODE || this.PHRASING_ELEMS.indexOf(node.tagName) !== -1 ||
      ((node.tagName === "A" || node.tagName === "DEL" || node.tagName === "INS") &&
        this._everyNode(node.childNodes, this._isPhrasingContent));
  }