UNPKG

918 BJavaScriptView Raw
1/**
2 * Detects whether an element's content has horizontal overflow
3 *
4 * @public
5 * @param element - Element to check for overflow
6 * @returns True if element's content overflows
7 */
8export function hasHorizontalOverflow(element) {
9 return element.clientWidth < element.scrollWidth;
10}
11/**
12 * Detects whether an element's content has vertical overflow
13 *
14 * @public
15 * @param element - Element to check for overflow
16 * @returns True if element's content overflows
17 */
18export function hasVerticalOverflow(element) {
19 return element.clientHeight < element.scrollHeight;
20}
21/**
22 * Detects whether an element's content has overflow in any direction
23 *
24 * @public
25 * @param element - Element to check for overflow
26 * @returns True if element's content overflows
27 */
28export function hasOverflow(element) {
29 return hasHorizontalOverflow(element) || hasVerticalOverflow(element);
30}
31//# sourceMappingURL=overflow.js.map
\No newline at end of file