isVisible.js 788 B

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _default = exports.default = function _default(element) {
  7. if (!element) {
  8. return false;
  9. }
  10. if (element instanceof Element) {
  11. if (element.offsetParent) {
  12. return true;
  13. }
  14. if (element.getBBox) {
  15. var _getBBox = element.getBBox(),
  16. width = _getBBox.width,
  17. height = _getBBox.height;
  18. if (width || height) {
  19. return true;
  20. }
  21. }
  22. if (element.getBoundingClientRect) {
  23. var _element$getBoundingC = element.getBoundingClientRect(),
  24. _width = _element$getBoundingC.width,
  25. _height = _element$getBoundingC.height;
  26. if (_width || _height) {
  27. return true;
  28. }
  29. }
  30. }
  31. return false;
  32. };