MCPcopy
hub / github.com/react-component/form / getScrollableContainer

Function getScrollableContainer

src/createDOMForm.js:34–51  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

32}
33
34function getScrollableContainer(n) {
35 let node = n;
36 let nodeName;
37 /* eslint no-cond-assign:0 */
38 while ((nodeName = node.nodeName.toLowerCase()) !== 'body') {
39 const overflowY = computedStyle(node, 'overflowY');
40 // https://stackoverflow.com/a/36900407/3040605
41 if (
42 node !== n &&
43 (overflowY === 'auto' || overflowY === 'scroll') &&
44 node.scrollHeight > node.clientHeight
45 ) {
46 return node;
47 }
48 node = node.parentNode;
49 }
50 return nodeName === 'body' ? node.ownerDocument : node;
51}
52
53const mixin = {
54 getForm() {

Callers 1

newCbFunction · 0.85

Calls 1

computedStyleFunction · 0.85

Tested by

no test coverage detected