blob: db52091f7fc554f97f041394ed7b47547d52431e [file] [log] [blame]
{"version":3,"file":"tobago-utils.js","sourceRoot":"../ts/","sources":["tobago-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,6BAA6B;AAC7B,MAAM,OAAO,QAAQ;IAEnB;;;;OAIG;IACH,gFAAgF;IAChF,MAAM,CAAC,sBAAsB,CAAC,OAAoB,EAAE,SAAiB;QACnE,MAAM,MAAM,GAAuB,IAAI,KAAK,EAAe,CAAC;QAC5D,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACtB;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE;YACvD,MAAM,CAAC,IAAI,CAAC,KAAoB,CAAC,CAAC;SACnC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,OAAoB;QAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAW,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC/D,MAAM,QAAQ,GAAW,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACrE,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC;IACnC,CAAC;CACF","sourcesContent":["/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// XXX remove me, for cleanup\nexport class DomUtils {\n\n /**\n * Find all elements (and also self) which have the attribute \"attributeName\".\n * @param element Starting element in DOM to collect.\n * @param selectors Name of the attribute of the elements to find.\n */\n // todo: may return NodeListOf<HTMLElementTagNameMap[K]> or something like that.\n static selfOrQuerySelectorAll(element: HTMLElement, selectors: string): Array<HTMLElement> {\n const result: Array<HTMLElement> = new Array<HTMLElement>();\n if (element.matches(selectors)) {\n result.push(element);\n }\n for (const found of element.querySelectorAll(selectors)) {\n result.push(found as HTMLElement);\n }\n return result;\n }\n\n /**\n * @param element with transition\n * @return transition time in milliseconds\n */\n static getTransitionTime(element: HTMLElement): number {\n const style = window.getComputedStyle(element);\n const delay: number = Number.parseFloat(style.transitionDelay);\n const duration: number = Number.parseFloat(style.transitionDuration);\n return (delay + duration) * 1000;\n }\n}\n"]}