Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

32 linhas
751 B

  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow
  9. * @emails oncall+draft_js
  10. */
  11. function isInstanceOfNode(target: ?EventTarget): boolean {
  12. // we changed the name because of having duplicate module provider (fbjs)
  13. if (!target || !('ownerDocument' in target)) {
  14. return false;
  15. }
  16. if ('ownerDocument' in target) {
  17. const node: Node = (target: any);
  18. if (!node.ownerDocument.defaultView) {
  19. return node instanceof Node;
  20. }
  21. if (node instanceof node.ownerDocument.defaultView.Node) {
  22. return true;
  23. }
  24. }
  25. return false;
  26. }
  27. module.exports = isInstanceOfNode;