UNPKG

1.62 kBJavaScriptView Raw
1import { window } from './facade/browser';
2import { currentBsVersion } from './theme-provider';
3export class Utils {
4 // eslint-disable-next-line @typescript-eslint/no-explicit-any
5 static reflow(element) {
6 // eslint-disable-next-line @typescript-eslint/no-explicit-any
7 ((bs) => bs)(element.offsetHeight);
8 }
9 // source: https://github.com/jquery/jquery/blob/master/src/css/var/getStyles.js
10 // eslint-disable-next-line @typescript-eslint/no-explicit-any
11 static getStyles(elem) {
12 // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
13 // IE throws on elements created in popups
14 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
15 let view = elem.ownerDocument.defaultView;
16 if (!view || !view.opener) {
17 view = window;
18 }
19 return view.getComputedStyle(elem);
20 }
21 static stackOverflowConfig() {
22 const bsVer = currentBsVersion();
23 return {
24 crossorigin: bsVer !== 'bs3' ? "anonymous" : undefined,
25 integrity: bsVer === 'bs5' ? 'sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We' : bsVer === 'bs4' ? 'sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2' : undefined,
26 cdnLink: bsVer === 'bs5' ? 'https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css' : bsVer === 'bs4' ? 'https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css' : 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css',
27 };
28 }
29}
30//# sourceMappingURL=utils.class.js.map
\No newline at end of file