MCPcopy Create free account
hub / github.com/ElemeFE/element-react / getScrollBarWidth

Function getScrollBarWidth

src/table/utils.js:9–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7let scrollBarWidth: ?number;
8
9export function getScrollBarWidth(): ?number {
10 if (scrollBarWidth !== undefined) return scrollBarWidth;
11 const dom = _document.createElement('div');
12 const body = _document.body || dom;
13
14 dom.style.visibility = 'hidden';
15 dom.style.width = '100px';
16 dom.style.position = 'absolute';
17 dom.style.top = '-9999px';
18 dom.style.overflow = 'scroll';
19
20 body.appendChild(dom);
21
22 const totalWidth = dom.offsetWidth;
23 const widthWithoutScroll = dom.clientWidth;
24
25 body.removeChild(dom);
26
27 return totalWidth - widthWithoutScroll;
28}
29
30export function getValueByPath(data: Object, path: ?string): any {
31 if (typeof path !== 'string') return null;

Callers 1

constructorMethod · 0.90

Calls 1

removeChildMethod · 0.80

Tested by

no test coverage detected