You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 regels
723 B

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