diff options
Diffstat (limited to 'src/ClientUtils.ts')
-rw-r--r-- | src/ClientUtils.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ClientUtils.ts b/src/ClientUtils.ts index 55801df81..2b623625d 100644 --- a/src/ClientUtils.ts +++ b/src/ClientUtils.ts @@ -82,6 +82,10 @@ export function returnEmptyFilter() { return [] as string[]; } +export function returnEmptyDoclist() { + return [] as any[]; +} + export namespace ClientUtils { export const CLICK_TIME = 300; export const DRAG_THRESHOLD = 4; @@ -445,10 +449,11 @@ export function smoothScrollHorizontal(duration: number, element: HTMLElement | animateScroll(); } -export function addStyleSheet() { +export function addStyleSheet(styleType: string = 'text/css') { const style = document.createElement('style'); + style.type = styleType; const sheets = document.head.appendChild(style); - return sheets.sheet; + return (sheets as any).sheet; } export function addStyleSheetRule(sheet: CSSStyleSheet | null, selector: string, css: string | { [key: string]: string }, selectorPrefix = '.') { const propText = @@ -457,7 +462,7 @@ export function addStyleSheetRule(sheet: CSSStyleSheet | null, selector: string, : Object.keys(css) .map(p => p + ':' + (p === 'content' ? "'" + css[p] + "'" : css[p])) .join(';'); - return sheet?.insertRule(selectorPrefix + selector + '{' + propText + '}', sheet.cssRules.length); + return sheet.insertRule(selectorPrefix + selector + '{' + propText + '}', sheet.cssRules.length); } export function removeStyleSheetRule(sheet: CSSStyleSheet | null, rule: number) { if (sheet?.rules.length) { |