Skip to content

Commit 720c9d4

Browse files
authored
[dom utils] Add getBoundingClientRect method (#1051)
1 parent 1e6f537 commit 720c9d4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/utils/dom.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ dom.getAttr = function(el, attr) {
121121
return null;
122122
};
123123

124+
// Retur nteh Bounding Client Rec of an element. Retruns null if not an element
125+
dom.getBCR = function(el) {
126+
return dom.isElement(el) ? el.getBoundingClientRect() : null;
127+
};
124128

125129
export const isElement = dom.isElement;
126130
export const isVisible = dom.isVisible;
@@ -136,3 +140,4 @@ export const hasClass = dom.hasClass;
136140
export const setAttr = dom.setAttr;
137141
export const removeAttr = dom.removeAttr;
138142
export const getAttr = dom.getAttr;
143+
export const getBCR = dom.getBCR;

0 commit comments

Comments
 (0)