[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/vendor/bootstrap/js/ -> dom.min.js (source)

   1  const MAX_UID=1e6,MILLISECONDS_MULTIPLIER=1e3,TRANSITION_END="transitionend",toType=e=>null==e?`$e}`:{}.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(),getUID=e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e},getSelector=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let n=e.getAttribute("href");if(!n||!n.includes("#")&&!n.startsWith("."))return null;n.includes("#")&&!n.startsWith("#")&&(n=`#$n.split("#")[1]}`),t=n&&"#"!==n?n.trim():null}return t},getSelectorFromElement=e=>{const t=getSelector(e);return t&&document.querySelector(t)?t:null},getElementFromSelector=e=>{const t=getSelector(e);return t?document.querySelector(t):null},getTransitionDurationFromElement=e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:n}=window.getComputedStyle(e);const o=Number.parseFloat(t),i=Number.parseFloat(n);return o||i?(t=t.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(n))):0},triggerTransitionEnd=e=>{e.dispatchEvent(new Event(TRANSITION_END))},isElement=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),getElement=e=>isElement(e)?e.jquery?e[0]:e:"string"==typeof e&&e.length>0?document.querySelector(e):null,typeCheckConfig=(e,t,n)=>{Object.keys(n).forEach((o=>{const i=n[o],r=t[o],s=r&&isElement(r)?"element":null==(a=r)?`$a}`:{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase();var a;if(!new RegExp(i).test(s))throw new TypeError(`$e.toUpperCase()}: Option "$o}" provided type "$s}" but expected type "$i}".`)}))},isVisible=e=>!(!isElement(e)||0===e.getClientRects().length)&&"visible"===getComputedStyle(e).getPropertyValue("visibility"),isDisabled=e=>!e||e.nodeType!==Node.ELEMENT_NODE||(!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled"))),findShadowRoot=e=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof e.getRootNode){const t=e.getRootNode();return t instanceof ShadowRoot?t:null}return e instanceof ShadowRoot?e:e.parentNode?findShadowRoot(e.parentNode):null},noop=()=>{},reflow=e=>{e.offsetHeight},getjQuery=()=>{const{jQuery:e}=window;return e&&!document.body.hasAttribute("data-bs-no-jquery")?e:null},DOMContentLoadedCallbacks=[],onDOMContentLoaded=e=>{"loading"===document.readyState?(DOMContentLoadedCallbacks.length||document.addEventListener("DOMContentLoaded",(()=>{DOMContentLoadedCallbacks.forEach((e=>e()))})),DOMContentLoadedCallbacks.push(e)):e()},isRTL=()=>"rtl"===document.documentElement.dir,defineJQueryPlugin=e=>{var t;t=()=>{const t=getjQuery();if(t){const n=e.NAME,o=t.fn[n];t.fn[n]=e.jQueryInterface,t.fn[n].Constructor=e,t.fn[n].noConflict=()=>(t.fn[n]=o,e.jQueryInterface)}},"loading"===document.readyState?(DOMContentLoadedCallbacks.length||document.addEventListener("DOMContentLoaded",(()=>{DOMContentLoadedCallbacks.forEach((e=>e()))})),DOMContentLoadedCallbacks.push(t)):t()},execute=e=>{"function"==typeof e&&e()},executeAfterTransition=function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!n)return void execute(e);const o=5,i=getTransitionDurationFromElement(t)+o;let r=!1;const s=n=>{let{target:o}=n;o===t&&(r=!0,t.removeEventListener(TRANSITION_END,s),execute(e))};t.addEventListener(TRANSITION_END,s),setTimeout((()=>{r||triggerTransitionEnd(t)}),i)},getNextActiveElement=(e,t,n,o)=>{let i=e.indexOf(t);if(-1===i)return e[!n&&o?e.length-1:0];const r=e.length;return i+=n?1:-1,o&&(i=(i+r)%r),e[Math.max(0,Math.min(i,r-1))]},namespaceRegex=/[^.]*(?=\..*)\.|.*/,stripNameRegex=/\..*/,stripUidRegex=/::\d+$/,eventRegistry={};let uidEvent=1;const customEvents={mouseenter:"mouseover",mouseleave:"mouseout"},customEventsRegex=/^(mouseenter|mouseleave)/i,nativeEvents=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function getUidEvent(e,t){return t&&`$t}::$uidEvent++}`||e.uidEvent||uidEvent++}function getEvent(e){const t=getUidEvent(e);return e.uidEvent=t,eventRegistry[t]=eventRegistry[t]||{},eventRegistry[t]}function bootstrapHandler(e,t){return function n(o){return o.delegateTarget=e,n.oneOff&&EventHandler.off(e,o.type,t),t.apply(e,[o])}}function bootstrapDelegationHandler(e,t,n){return function o(i){const r=e.querySelectorAll(t);for(let{target:s}=i;s&&s!==this;s=s.parentNode)for(let a=r.length;a--;)if(r[a]===s)return i.delegateTarget=s,o.oneOff&&EventHandler.off(e,i.type,t,n),n.apply(s,[i]);return null}}function findHandler(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const o=Object.keys(e);for(let i=0,r=o.length;i<r;i++){const r=e[o[i]];if(r.originalHandler===t&&r.delegationSelector===n)return r}return null}function normalizeParams(e,t,n){const o="string"==typeof t,i=o?n:t;let r=getTypeEvent(e);return nativeEvents.has(r)||(r=e),[o,i,r]}function addHandler(e,t,n,o,i){if("string"!=typeof t||!e)return;if(n||(n=o,o=null),customEventsRegex.test(t)){const e=e=>function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)};o?o=e(o):n=e(n)}const[r,s,a]=normalizeParams(t,n,o),l=getEvent(e),c=l[a]||(l[a]={}),d=findHandler(c,s,r?n:null);if(d)return void(d.oneOff=d.oneOff&&i);const u=getUidEvent(s,t.replace(namespaceRegex,"")),m=r?bootstrapDelegationHandler(e,n,o):bootstrapHandler(e,n);m.delegationSelector=r?n:null,m.originalHandler=s,m.oneOff=i,m.uidEvent=u,c[u]=m,e.addEventListener(a,m,r)}function removeHandler(e,t,n,o,i){const r=findHandler(t[n],o,i);r&&(e.removeEventListener(n,r,Boolean(i)),delete t[n][r.uidEvent])}function removeNamespacedHandlers(e,t,n,o){const i=t[n]||{};Object.keys(i).forEach((r=>{if(r.includes(o)){const o=i[r];removeHandler(e,t,n,o.originalHandler,o.delegationSelector)}}))}function getTypeEvent(e){return e=e.replace(stripNameRegex,""),customEvents[e]||e}const EventHandler={on(e,t,n,o){addHandler(e,t,n,o,!1)},one(e,t,n,o){addHandler(e,t,n,o,!0)},off(e,t,n,o){if("string"!=typeof t||!e)return;const[i,r,s]=normalizeParams(t,n,o),a=s!==t,l=getEvent(e),c=t.startsWith(".");if(void 0!==r){if(!l||!l[s])return;return void removeHandler(e,l,s,r,i?n:null)}c&&Object.keys(l).forEach((n=>{removeNamespacedHandlers(e,l,n,t.slice(1))}));const d=l[s]||{};Object.keys(d).forEach((n=>{const o=n.replace(stripUidRegex,"");if(!a||t.includes(o)){const t=d[n];removeHandler(e,l,s,t.originalHandler,t.delegationSelector)}}))},trigger(e,t,n){if("string"!=typeof t||!e)return null;const o=getjQuery(),i=getTypeEvent(t),r=t!==i,s=nativeEvents.has(i);let a,l=!0,c=!0,d=!1,u=null;return r&&o&&(a=o.Event(t,n),o(e).trigger(a),l=!a.isPropagationStopped(),c=!a.isImmediatePropagationStopped(),d=a.isDefaultPrevented()),s?(u=document.createEvent("HTMLEvents"),u.initEvent(i,l,!0)):u=new CustomEvent(t,{bubbles:l,cancelable:!0}),void 0!==n&&Object.keys(n).forEach((e=>{Object.defineProperty(u,e,{get:()=>n[e]})})),d&&u.preventDefault(),c&&e.dispatchEvent(u),u.defaultPrevented&&void 0!==a&&a.preventDefault(),u}},elementMap=new Map;var Data={set(e,t,n){elementMap.has(e)||elementMap.set(e,new Map);const o=elementMap.get(e);o.has(t)||0===o.size?o.set(t,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: $Array.from(o.keys())[0]}.`)},get:(e,t)=>elementMap.has(e)&&elementMap.get(e).get(t)||null,remove(e,t){if(!elementMap.has(e))return;const n=elementMap.get(e);n.delete(t),0===n.size&&elementMap.delete(e)}};const VERSION="5.1.3";class BaseComponent{constructor(e){(e=getElement(e))&&(this._element=e,Data.set(this._element,this.constructor.DATA_KEY,this))}dispose(){Data.remove(this._element,this.constructor.DATA_KEY),EventHandler.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach((e=>{this[e]=null}))}_queueCallback(e,t){executeAfterTransition(e,t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}static getInstance(e){return Data.get(getElement(e),this.DATA_KEY)}static getOrCreateInstance(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return"5.1.3"}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}static get DATA_KEY(){return`bs.$this.NAME}`}static get EVENT_KEY(){return`.$this.DATA_KEY}`}}const enableDismissTrigger=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hide";const n=`click.dismiss$e.EVENT_KEY}`,o=e.NAME;EventHandler.on(document,n,`[data-bs-dismiss="$o}"]`,(function(n){if(["A","AREA"].includes(this.tagName)&&n.preventDefault(),isDisabled(this))return;const i=getElementFromSelector(this)||this.closest(`.$o}`);e.getOrCreateInstance(i)[t]()}))};function normalizeData(e){return"true"===e||"false"!==e&&(e===Number(e).toString()?Number(e):""===e||"null"===e?null:e)}function normalizeDataKey(e){return e.replace(/[A-Z]/g,(e=>`-$e.toLowerCase()}`))}const Manipulator={setDataAttribute(e,t,n){e.setAttribute(`data-bs-$normalizeDataKey(t)}`,n)},removeDataAttribute(e,t){e.removeAttribute(`data-bs-$normalizeDataKey(t)}`)},getDataAttributes(e){if(!e)return{};const t={};return Object.keys(e.dataset).filter((e=>e.startsWith("bs"))).forEach((n=>{let o=n.replace(/^bs/,"");o=o.charAt(0).toLowerCase()+o.slice(1,o.length),t[o]=normalizeData(e.dataset[n])})),t},getDataAttribute:(e,t)=>normalizeData(e.getAttribute(`data-bs-$normalizeDataKey(t)}`)),offset(e){const t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}},position:e=>({top:e.offsetTop,left:e.offsetLeft})},NODE_TEXT=3,SelectorEngine={find(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return[].concat(...Element.prototype.querySelectorAll.call(t,e))},findOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return Element.prototype.querySelector.call(t,e)},children:(e,t)=>[].concat(...e.children).filter((e=>e.matches(t))),parents(e,t){const n=[];let o=e.parentNode;for(;o&&o.nodeType===Node.ELEMENT_NODE&&3!==o.nodeType;)o.matches(t)&&n.push(o),o=o.parentNode;return n},prev(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return[n];n=n.previousElementSibling}return[]},next(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return[n];n=n.nextElementSibling}return[]},focusableChildren(e){const t=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((e=>`$e}:not([tabindex^="-"])`)).join(", ");return this.find(t,e).filter((e=>!isDisabled(e)&&isVisible(e)))}},SELECTOR_FIXED_CONTENT=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",SELECTOR_STICKY_CONTENT=".sticky-top";class ScrollBarHelper{constructor(){this._element=document.body}getWidth(){const e=document.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}hide(){const e=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,"paddingRight",(t=>t+e)),this._setElementAttributes(SELECTOR_FIXED_CONTENT,"paddingRight",(t=>t+e)),this._setElementAttributes(".sticky-top","marginRight",(t=>t-e))}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(e,t,n){const o=this.getWidth();this._applyManipulationCallback(e,(e=>{if(e!==this._element&&window.innerWidth>e.clientWidth+o)return;this._saveInitialAttribute(e,t);const i=window.getComputedStyle(e)[t];e.style[t]=`$n(Number.parseFloat(i))}px`}))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes(SELECTOR_FIXED_CONTENT,"paddingRight"),this._resetElementAttributes(".sticky-top","marginRight")}_saveInitialAttribute(e,t){const n=e.style[t];n&&Manipulator.setDataAttribute(e,t,n)}_resetElementAttributes(e,t){this._applyManipulationCallback(e,(e=>{const n=Manipulator.getDataAttribute(e,t);void 0===n?e.style.removeProperty(t):(Manipulator.removeDataAttribute(e,t),e.style[t]=n)}))}_applyManipulationCallback(e,t){isElement(e)?t(e):SelectorEngine.find(e,this._element).forEach(t)}isOverflowing(){return this.getWidth()>0}}const Default$1={className:"modal-backdrop",isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},DefaultType$1={className:"string",isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},NAME$1="backdrop",CLASS_NAME_FADE="fade",CLASS_NAME_SHOW="show",EVENT_MOUSEDOWN="mousedown.bs.backdrop";class Backdrop{constructor(e){this._config=this._getConfig(e),this._isAppended=!1,this._element=null}show(e){this._config.isVisible?(this._append(),this._config.isAnimated&&reflow(this._getElement()),this._getElement().classList.add("show"),this._emulateAnimation((()=>{execute(e)}))):execute(e)}hide(e){this._config.isVisible?(this._getElement().classList.remove("show"),this._emulateAnimation((()=>{this.dispose(),execute(e)}))):execute(e)}_getElement(){if(!this._element){const e=document.createElement("div");e.className=this._config.className,this._config.isAnimated&&e.classList.add("fade"),this._element=e}return this._element}_getConfig(e){return(e={...Default$1,..."object"==typeof e?e:{}}).rootElement=getElement(e.rootElement),typeCheckConfig(NAME$1,e,DefaultType$1),e}_append(){this._isAppended||(this._config.rootElement.append(this._getElement()),EventHandler.on(this._getElement(),EVENT_MOUSEDOWN,(()=>{execute(this._config.clickCallback)})),this._isAppended=!0)}dispose(){this._isAppended&&(EventHandler.off(this._element,EVENT_MOUSEDOWN),this._element.remove(),this._isAppended=!1)}_emulateAnimation(e){executeAfterTransition(e,this._getElement(),this._config.isAnimated)}}const Default={trapElement:null,autofocus:!0},DefaultType={trapElement:"element",autofocus:"boolean"},NAME="focustrap",DATA_KEY="bs.focustrap",EVENT_KEY=`.$DATA_KEY}`,EVENT_FOCUSIN=`focusin$EVENT_KEY}`,EVENT_KEYDOWN_TAB=`keydown.tab$EVENT_KEY}`,TAB_KEY="Tab",TAB_NAV_FORWARD="forward",TAB_NAV_BACKWARD="backward";class FocusTrap{constructor(e){this._config=this._getConfig(e),this._isActive=!1,this._lastTabNavDirection=null}activate(){const{trapElement:e,autofocus:t}=this._config;this._isActive||(t&&e.focus(),EventHandler.off(document,EVENT_KEY),EventHandler.on(document,EVENT_FOCUSIN,(e=>this._handleFocusin(e))),EventHandler.on(document,EVENT_KEYDOWN_TAB,(e=>this._handleKeydown(e))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,EventHandler.off(document,EVENT_KEY))}_handleFocusin(e){const{target:t}=e,{trapElement:n}=this._config;if(t===document||t===n||n.contains(t))return;const o=SelectorEngine.focusableChildren(n);0===o.length?n.focus():"backward"===this._lastTabNavDirection?o[o.length-1].focus():o[0].focus()}_handleKeydown(e){"Tab"===e.key&&(this._lastTabNavDirection=e.shiftKey?"backward":"forward")}_getConfig(e){return e={...Default,..."object"==typeof e?e:{}},typeCheckConfig(NAME,e,DefaultType),e}}const uriAttributes=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),ARIA_ATTRIBUTE_PATTERN=/^aria-[\w-]*$/i,SAFE_URL_PATTERN=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,DATA_URL_PATTERN=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,allowedAttribute=(e,t)=>{const n=e.nodeName.toLowerCase();if(t.includes(n))return!uriAttributes.has(n)||Boolean(SAFE_URL_PATTERN.test(e.nodeValue)||DATA_URL_PATTERN.test(e.nodeValue));const o=t.filter((e=>e instanceof RegExp));for(let e=0,t=o.length;e<t;e++)if(o[e].test(n))return!0;return!1},DefaultAllowlist={"*":["class","dir","id","lang","role",ARIA_ATTRIBUTE_PATTERN],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]};function sanitizeHtml(e,t,n){if(!e.length)return e;if(n&&"function"==typeof n)return n(e);const o=(new window.DOMParser).parseFromString(e,"text/html"),i=[].concat(...o.body.querySelectorAll("*"));for(let e=0,n=i.length;e<n;e++){const n=i[e],o=n.nodeName.toLowerCase();if(!Object.keys(t).includes(o)){n.remove();continue}const r=[].concat(...n.attributes),s=[].concat(t["*"]||[],t[o]||[]);r.forEach((e=>{allowedAttribute(e,s)||n.removeAttribute(e.nodeName)}))}return o.body.innerHTML}export{BaseComponent as B,Data as D,EventHandler as E,FocusTrap as F,Manipulator as M,SelectorEngine as S,typeCheckConfig as a,isRTL as b,getElementFromSelector as c,defineJQueryPlugin as d,enableDismissTrigger as e,getSelectorFromElement as f,getNextActiveElement as g,getElement as h,isVisible as i,isDisabled as j,isElement as k,ScrollBarHelper as l,Backdrop as m,noop as n,findShadowRoot as o,getUID as p,DefaultAllowlist as q,reflow as r,sanitizeHtml as s,triggerTransitionEnd as t};


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer