MCPcopy Create free account
hub / github.com/textAngular/textAngular / isScrollable

Function isScrollable

src/main.js:142–167  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

140 // we want to know if a given node has a scrollbar!
141 // credit to lotif on http://stackoverflow.com/questions/4880381/check-whether-html-element-has-scrollbars
142 var isScrollable = function(node) {
143 var cs;
144 var _notScrollable = {
145 vertical: false,
146 horizontal: false,
147 };
148 try {
149 cs = window.getComputedStyle(node);
150 if (cs === null) {
151 return _notScrollable;
152 }
153 } catch (e) {
154 /* istanbul ignore next: error handler */
155 return _notScrollable;
156 }
157 var overflowY = cs['overflow-y'];
158 var overflowX = cs['overflow-x'];
159 return {
160 vertical: (overflowY === 'scroll' || overflowY === 'auto') &&
161 /* istanbul ignore next: not tested */
162 node.scrollHeight > node.clientHeight,
163 horizontal: (overflowX === 'scroll' || overflowX === 'auto') &&
164 /* istanbul ignore next: not tested */
165 node.scrollWidth > node.clientWidth,
166 };
167 };
168
169 // getScrollTop
170 //

Callers 1

main.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…