af46fcf9c6ff6e8eb051b85175dd2a21.json
3.67 KB
{"ast":null,"code":"var cached;\nexport default function getScrollBarSize(fresh) {\n if (typeof document === 'undefined') {\n return 0;\n }\n\n if (fresh || cached === undefined) {\n var inner = document.createElement('div');\n inner.style.width = '100%';\n inner.style.height = '200px';\n var outer = document.createElement('div');\n var outerStyle = outer.style;\n outerStyle.position = 'absolute';\n outerStyle.top = 0;\n outerStyle.left = 0;\n outerStyle.pointerEvents = 'none';\n outerStyle.visibility = 'hidden';\n outerStyle.width = '200px';\n outerStyle.height = '150px';\n outerStyle.overflow = 'hidden';\n outer.appendChild(inner);\n document.body.appendChild(outer);\n var widthContained = inner.offsetWidth;\n outer.style.overflow = 'scroll';\n var widthScroll = inner.offsetWidth;\n\n if (widthContained === widthScroll) {\n widthScroll = outer.clientWidth;\n }\n\n document.body.removeChild(outer);\n cached = widthContained - widthScroll;\n }\n\n return cached;\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-util/es/getScrollBarSize.js"],"names":["cached","getScrollBarSize","fresh","document","undefined","inner","createElement","style","width","height","outer","outerStyle","position","top","left","pointerEvents","visibility","overflow","appendChild","body","widthContained","offsetWidth","widthScroll","clientWidth","removeChild"],"mappings":"AAAA,IAAIA,MAAJ;AACA,eAAe,SAASC,gBAAT,CAA0BC,KAA1B,EAAiC;AAC9C,MAAI,OAAOC,QAAP,KAAoB,WAAxB,EAAqC;AACnC,WAAO,CAAP;AACD;;AAED,MAAID,KAAK,IAAIF,MAAM,KAAKI,SAAxB,EAAmC;AACjC,QAAIC,KAAK,GAAGF,QAAQ,CAACG,aAAT,CAAuB,KAAvB,CAAZ;AACAD,IAAAA,KAAK,CAACE,KAAN,CAAYC,KAAZ,GAAoB,MAApB;AACAH,IAAAA,KAAK,CAACE,KAAN,CAAYE,MAAZ,GAAqB,OAArB;AACA,QAAIC,KAAK,GAAGP,QAAQ,CAACG,aAAT,CAAuB,KAAvB,CAAZ;AACA,QAAIK,UAAU,GAAGD,KAAK,CAACH,KAAvB;AACAI,IAAAA,UAAU,CAACC,QAAX,GAAsB,UAAtB;AACAD,IAAAA,UAAU,CAACE,GAAX,GAAiB,CAAjB;AACAF,IAAAA,UAAU,CAACG,IAAX,GAAkB,CAAlB;AACAH,IAAAA,UAAU,CAACI,aAAX,GAA2B,MAA3B;AACAJ,IAAAA,UAAU,CAACK,UAAX,GAAwB,QAAxB;AACAL,IAAAA,UAAU,CAACH,KAAX,GAAmB,OAAnB;AACAG,IAAAA,UAAU,CAACF,MAAX,GAAoB,OAApB;AACAE,IAAAA,UAAU,CAACM,QAAX,GAAsB,QAAtB;AACAP,IAAAA,KAAK,CAACQ,WAAN,CAAkBb,KAAlB;AACAF,IAAAA,QAAQ,CAACgB,IAAT,CAAcD,WAAd,CAA0BR,KAA1B;AACA,QAAIU,cAAc,GAAGf,KAAK,CAACgB,WAA3B;AACAX,IAAAA,KAAK,CAACH,KAAN,CAAYU,QAAZ,GAAuB,QAAvB;AACA,QAAIK,WAAW,GAAGjB,KAAK,CAACgB,WAAxB;;AAEA,QAAID,cAAc,KAAKE,WAAvB,EAAoC;AAClCA,MAAAA,WAAW,GAAGZ,KAAK,CAACa,WAApB;AACD;;AAEDpB,IAAAA,QAAQ,CAACgB,IAAT,CAAcK,WAAd,CAA0Bd,KAA1B;AACAV,IAAAA,MAAM,GAAGoB,cAAc,GAAGE,WAA1B;AACD;;AAED,SAAOtB,MAAP;AACD","sourcesContent":["var cached;\nexport default function getScrollBarSize(fresh) {\n if (typeof document === 'undefined') {\n return 0;\n }\n\n if (fresh || cached === undefined) {\n var inner = document.createElement('div');\n inner.style.width = '100%';\n inner.style.height = '200px';\n var outer = document.createElement('div');\n var outerStyle = outer.style;\n outerStyle.position = 'absolute';\n outerStyle.top = 0;\n outerStyle.left = 0;\n outerStyle.pointerEvents = 'none';\n outerStyle.visibility = 'hidden';\n outerStyle.width = '200px';\n outerStyle.height = '150px';\n outerStyle.overflow = 'hidden';\n outer.appendChild(inner);\n document.body.appendChild(outer);\n var widthContained = inner.offsetWidth;\n outer.style.overflow = 'scroll';\n var widthScroll = inner.offsetWidth;\n\n if (widthContained === widthScroll) {\n widthScroll = outer.clientWidth;\n }\n\n document.body.removeChild(outer);\n cached = widthContained - widthScroll;\n }\n\n return cached;\n}"]},"metadata":{},"sourceType":"module"}