()
| 19 | } |
| 20 | |
| 21 | export function getScrollBarSize() { |
| 22 | if (_scrollBarSize) { |
| 23 | return _scrollBarSize; |
| 24 | } |
| 25 | const inner = document.createElement('div'); |
| 26 | inner.style.width = '100%'; |
| 27 | inner.style.height = '200px'; |
| 28 | |
| 29 | const outer = document.createElement('div'); |
| 30 | extend(outer.style, { |
| 31 | position: 'absolute', |
| 32 | top: 0, |
| 33 | left: 0, |
| 34 | pointerEvents: 'none', |
| 35 | visibility: 'hidden', |
| 36 | width: '200px', |
| 37 | height: '150px', |
| 38 | overflow: 'hidden' |
| 39 | }); |
| 40 | |
| 41 | outer.appendChild(inner); |
| 42 | |
| 43 | document.body.appendChild(outer); |
| 44 | |
| 45 | const widthContained = inner.offsetWidth; |
| 46 | outer.style.overflow = 'scroll'; |
| 47 | let widthScroll = inner.offsetWidth; |
| 48 | |
| 49 | if (widthContained === widthScroll) { |
| 50 | widthScroll = outer.clientWidth; |
| 51 | } |
| 52 | |
| 53 | document.body.removeChild(outer); |
| 54 | |
| 55 | const width = widthContained - widthScroll; |
| 56 | |
| 57 | _scrollBarSize = { width, height: width }; |
| 58 | return _scrollBarSize; |
| 59 | } |
| 60 | |
| 61 | export const uniqueId = (() => { |
| 62 | let id = 0; |
nothing calls this directly
no test coverage detected
searching dependent graphs…