1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/js/dist/util.js.map
Mark Otto 8c587d4280 dist
2017-10-25 12:31:55 -07:00

1 line
No EOL
8 KiB
Text

{"version":3,"sources":["../src/util.js"],"names":["Util","$","transition","MAX_UID","TransitionEndEvent","WebkitTransition","toType","obj","toString","call","match","toLowerCase","getSpecialTransitionEndEvent","bindType","end","delegateType","handle","event","target","is","handleObj","handler","apply","arguments","undefined","transitionEndTest","window","QUnit","el","document","createElement","name","style","transitionEndEmulator","duration","called","one","TRANSITION_END","setTimeout","triggerTransitionEnd","setTransitionEndSupport","fn","emulateTransitionEnd","supportsTransitionEnd","special","getUID","prefix","Math","random","getElementById","getSelectorFromElement","element","selector","getAttribute","$selector","find","length","error","reflow","offsetHeight","trigger","Boolean","isElement","nodeType","typeCheckConfig","componentName","config","configTypes","property","Object","prototype","hasOwnProperty","expectedTypes","value","valueType","RegExp","test","Error","toUpperCase"],"mappings":"AAEA;;;;;;AAOA,IAAMA,OAAQ,UAACC,CAAD,EAAO;AAGnB;;;;;AAMA,MAAIC,aAAa,KAAjB;AAEA,MAAMC,UAAU,OAAhB;AAEA,MAAMC,qBAAqB;AACzBC,sBAAmB,qBADM;AAEzBH,gBAAmB,eAFM,CAK3B;;AAL2B,GAA3B;;AAMA,WAASI,MAAT,CAAgBC,GAAhB,EAAqB;AACnB,WAAO,GAAGC,QAAH,CAAYC,IAAZ,CAAiBF,GAAjB,EAAsBG,KAAtB,CAA4B,eAA5B,EAA6C,CAA7C,EAAgDC,WAAhD,EAAP;AACD;;AAED,WAASC,4BAAT,GAAwC;AACtC,WAAO;AACLC,gBAAUX,WAAWY,GADhB;AAELC,oBAAcb,WAAWY,GAFpB;AAGLE,YAHK,kBAGEC,KAHF,EAGS;AACZ,YAAIhB,EAAEgB,MAAMC,MAAR,EAAgBC,EAAhB,CAAmB,IAAnB,CAAJ,EAA8B;AAC5B,iBAAOF,MAAMG,SAAN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AK8D,SAAL,CAAeW,KAAf,CAAT,GACA,SADA,GACYnE,OAAOmE,KAAP,CADlC;;AAGA,cAAI,CAAC,IAAIE,MAAJ,CAAWH,aAAX,EAA0BI,IAA1B,CAA+BF,SAA/B,CAAL,EAAgD;AAC9C,kBAAM,IAAIG,KAAJ,CACDZ,cAAca,WAAd,EAAH,yBACWV,QADX,2BACuCM,SADvC,sCAEsBF,aAFtB,SADI,CAAN;AAID;AACF;AACF;AACF;AA1DU,GAAb;AA6DAhC;AAEA,SAAOxC,IAAP;AAED,CAxJY,CAwJVC,CAxJU,CAAb","file":"util.js","sourcesContent":["import $ from 'jquery'\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0-beta.2): util.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Util = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Private TransitionEnd Helpers\n * ------------------------------------------------------------------------\n */\n\n let transition = false\n\n const MAX_UID = 1000000\n\n const TransitionEndEvent = {\n WebkitTransition : 'webkitTransitionEnd',\n transition : 'transitionend'\n }\n\n // shoutout AngusCroll (https://goo.gl/pxwQGp)\n function toType(obj) {\n return {}.toString.call(obj).match(/\\s([a-zA-Z]+)/)[1].toLowerCase()\n }\n\n function getSpecialTransitionEndEvent() {\n return {\n bindType: transition.end,\n delegateType: transition.end,\n handle(event) {\n if ($(event.target).is(this)) {\n return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params\n }\n return undefined // eslint-disable-line no-undefined\n }\n }\n }\n\n function transitionEndTest() {\n if (window.QUnit) {\n return false\n }\n\n const el = document.createElement('bootstrap')\n\n for (const name in TransitionEndEvent) {\n if (typeof el.style[name] !== 'undefined') {\n return {\n end: TransitionEndEvent[name]\n }\n }\n }\n\n return false\n }\n\n function transitionEndEmulator(duration) {\n let called = false\n\n $(this).one(Util.TRANSITION_END, () => {\n called = true\n })\n\n setTimeout(() => {\n if (!called) {\n Util.triggerTransitionEnd(this)\n }\n }, duration)\n\n return this\n }\n\n function setTransitionEndSupport() {\n transition = transitionEndTest()\n\n $.fn.emulateTransitionEnd = transitionEndEmulator\n\n if (Util.supportsTransitionEnd()) {\n $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent()\n }\n }\n\n\n /**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\n const Util = {\n\n TRANSITION_END: 'bsTransitionEnd',\n\n getUID(prefix) {\n do {\n // eslint-disable-next-line no-bitwise\n prefix += ~~(Math.random() * MAX_UID) // \"~~\" acts like a faster Math.floor() here\n } while (document.getElementById(prefix))\n return prefix\n },\n\n getSelectorFromElement(element) {\n let selector = element.getAttribute('data-target')\n if (!selector || selector === '#') {\n selector = element.getAttribute('href') || ''\n }\n\n try {\n const $selector = $(document).find(selector)\n return $selector.length > 0 ? selector : null\n } catch (error) {\n return null\n }\n },\n\n reflow(element) {\n return element.offsetHeight\n },\n\n triggerTransitionEnd(element) {\n $(element).trigger(transition.end)\n },\n\n supportsTransitionEnd() {\n return Boolean(transition)\n },\n\n isElement(obj) {\n return (obj[0] || obj).nodeType\n },\n\n typeCheckConfig(componentName, config, configTypes) {\n for (const property in configTypes) {\n if (Object.prototype.hasOwnProperty.call(configTypes, property)) {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && Util.isElement(value) ?\n 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new Error(\n `${componentName.toUpperCase()}: ` +\n `Option \"${property}\" provided type \"${valueType}\" ` +\n `but expected type \"${expectedTypes}\".`)\n }\n }\n }\n }\n }\n\n setTransitionEndSupport()\n\n return Util\n\n})($)\n\nexport default Util\n"]}