Skip to content

Commit e4f7bfe

Browse files
committed
maint(Docs): Document core.dom.is_visible.
1 parent 369ff7c commit e4f7bfe

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/core/dom.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ const show = (el) => {
8080
delete el[DATA_STYLE_DISPLAY];
8181
};
8282

83+
/**
84+
* Test, if a element is visible or not.
85+
*
86+
* @param {Node} el - The DOM node to test.
87+
* @returns {Boolean} - True if the element is visible.
88+
*/
89+
const is_visible = (el) => {
90+
// Check, if element is visible in DOM.
91+
// https://stackoverflow.com/a/19808107/1337474
92+
return el.offsetWidth > 0 && el.offsetHeight > 0;
93+
};
94+
8395
/**
8496
* Return all direct parents of ``el`` matching ``selector``.
8597
* This matches against all parents but not the element itself.
@@ -169,12 +181,6 @@ const acquire_attribute = (
169181
}
170182
};
171183

172-
const is_visible = (el) => {
173-
// Check, if element is visible in DOM.
174-
// https://stackoverflow.com/a/19808107/1337474
175-
return el.offsetWidth > 0 && el.offsetHeight > 0;
176-
};
177-
178184
/**
179185
* Return a DocumentFragment from a given string.
180186
*

0 commit comments

Comments
 (0)