All files / roosterjs-content-model-dom/lib/domToModel/utils getDefaultStyle.ts

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 151x                 1x 9732x   9732x    
import { defaultHTMLStyleMap } from '../../config/defaultHTMLStyleMap';
import type { DefaultStyleMap } from 'roosterjs-content-model-types';
 
/**
 * @internal
 * Get default CSS style of given element
 * @param element The element to get default style from
 * @returns A valid CSS style object
 */
export function getDefaultStyle(element: HTMLElement): Partial<CSSStyleDeclaration> {
    const tag = element.tagName.toLowerCase() as keyof DefaultStyleMap;
 
    return defaultHTMLStyleMap[tag] || {};
}