<commit_before>const CUSTOM_PROPERTY_REGEX = /^--/;
const DEFAULT_STYLES = document.createElement("div").style;
const VENDOR_PREFIXES = ["-webkit-", "-moz-", "-o-", "-ms-"];
const propertyNameCache : { [key: string] : string } = {};
// DOM properties that should NOT have "px" added when numeric
const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
const DIRECTLY_ACCESSIBLE_SETTERS = /scroll(Top|Left)/i;
const HAS_PIXELS_UNIT = /px$/;


/**
 * Returns the normalized (like vendor-prefixed) name of the given CSS property
 */
function normalizeProperty (property : string) : string
{
    if (propertyNameCache[property])
    {
        return propertyNameCache[property];
    }

    // if the property already exists, just use it
    if (property in DEFAULT_STYLES)
    {
        return property;
    }

    for (let i = 0; i < VENDOR_PREFIXES.length; i++)
    {
        const prefixedName = `${VENDOR_PREFIXES[i]}${property}`;

        if (prefixedName in DEFAULT_STYLES)
        {
            propertyNameCache[property] = prefixedName;
            return prefixedName;
        }
    }

    propertyNameCache[property] = property;
    return property;
}


/**
 * Sets all styles on the element
 */
export function setStyles (elements : HTMLElement|HTMLElement[]|Window|Window[], styles : mojave.types.KeyMap) : void
{
    let styledElements : (HTMLElement|Window)[] = Array.isArray(elements) ? elements : [elements];

    for (let i = 0; i < styledElements.length; i++)
    {
        let element = styledElements[i] as mojave.types.StringIndexedHTMLElement;
        let style = element.style;

        for (let property in styles)
        {
            if (!styles.hasOwnProperty(property))
            {
                continue;
            }

            let value = styles[property];

            // handle directly accessible setters
            if (DIRECTLY_ACCESSIBLE_SETTERS.test(property))
            {
                element[property] = value;
                continue;<commit_msg>Fix missing type<commit_after>const CUSTOM_PROPERTY_REGEX = /^--/;
const DEFAULT_STYLES = document.createElement("div").style;
const VENDOR_PREFIXES = ["-webkit-", "-moz-", "-o-", "-ms-"];
const propertyNameCache : { [key: string] : string } = {};
// DOM properties that should NOT have "px" added when numeric
const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
const DIRECTLY_ACCESSIBLE_SETTERS = /scroll(Top|Left)/i;
const HAS_PIXELS_UNIT = /px$/;


/**
 * Returns the normalized (like vendor-prefixed) name of the given CSS property
 */
function normalizeProperty (property : string) : string
{
    if (propertyNameCache[property])
    {
        return propertyNameCache[property];
    }

    // if the property already exists, just use it
    if (property in DEFAULT_STYLES)
    {
        return property;
    }

    for (let i = 0; i < VENDOR_PREFIXES.length; i++)
    {
        const prefixedName = `${VENDOR_PREFIXES[i]}${property}`;

        if (prefixedName in DEFAULT_STYLES)
        {
            propertyNameCache[property] = prefixedName;
            return prefixedName;
        }
    }

    propertyNameCache[property] = property;
    return property;
}


/**
 * Sets all styles on the element
 */
export function setStyles (elements : HTMLElement|HTMLElement[]|Window|Window[], styles : {[key: string]: string|number}) : void
{
    let styledElements : (HTMLElement|Window)[] = Array.isArray(elements) ? elements : [elements];

    for (let i = 0; i < styledElements.length; i++)
    {
        let element = styledElements[i] as mojave.types.StringIndexedHTMLElement;
        let style = element.style;

        for (let property in styles)
        {
            if (!styles.hasOwnProperty(property))
            {
                continue;
            }

            let value = styles[property];

            // handle directly accessible setters
            if (DIRECTLY_ACCESSIBLE_SETTERS.test(property))
            {
                element[property] = value;
                continue;
{'fraction_non_alphanumeric': 0.12217305801376598, 'fraction_numerical': 0.0009832841691248771, 'mean_word_length': 2.6493273542600897, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6130654', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1222, 'n_words': 295}