Skip to content

Commit bfff63d

Browse files
committed
feat: Add isVisible
1 parent 69046a6 commit bfff63d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Dom/isVisible.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export default (element: HTMLElement | SVGGraphicsElement): boolean => {
2+
if (!element) {
3+
return false;
4+
}
5+
6+
if ((element as HTMLElement).offsetParent) {
7+
return true;
8+
}
9+
10+
if ((element as SVGGraphicsElement).getBBox) {
11+
const box = (element as SVGGraphicsElement).getBBox();
12+
if (box.width || box.height) {
13+
return true;
14+
}
15+
}
16+
17+
return false;
18+
};

0 commit comments

Comments
 (0)