<commit_before>module TouchPassr {
    "use strict";

    /**
     * Abstract class for on-screen controls. Element creation for .element
     * and .elementInner within the constrained position is provided.
     */
    export class Control<T extends IControlSchema> {
        /**
         * The parent TouchPassr's InputWritr. Pipe events are sent through here.
         */
        protected InputWriter: InputWritr.IInputWritr;

        /**
         * The governing schema for this control. It should be overriden as a more
         * specific shema in child classes.
         */
        protected schema: T;

        /**
         * The outer container element. It should have width and height of 0, so
         * it can be positioned using the schema's .position.
         */
        protected element: HTMLElement;

        /**
         * The inner container element, directly inside the outer container. It
         * should be positioned absolutely so its center is the outer container.
         */
        protected elementInner: HTMLElement;

        /**
         * Resets the control by setting member variables and calling resetElement.
         * 
         * @param InputWriter   The parent TouchPassr's InputWritr.
         * @param schema   The governing schema for this control.
         * @param styles   Any styles to add to the element.
         */
        constructor(InputWriter: InputWritr.IInputWritr, schema: T, styles: IRootControlStyles) {
            this.InputWriter = InputWriter;
            this.schema = schema;
            this.resetElement(styles);
        }

        /**
         * @returns The outer container element.
         */
        public getElement(): HTMLElement {
            return this.element;
        }

        /**
         * @returns The inner container element.
         */
        public getElementInner(): HTMLElement {
            return this.elementInner;
        }

        /**
         * Creates and returns an HTMLElement of the specified type. Any additional
         * settings Objects may be given to be proliferated onto the Element via
         * proliferateElement.
         * 
         * @param type   The tag of the Element to be created.
         * @param settings   Additional settings for the Element, such as className 
         *                   or style.
         * @returns A newly created HTMLElement of the specified type.
         */
        public createElement(tag: string, ...args: any[]): HTMLElement {
            var element: any = document.createElement(tag || "div"),
                i: number;

            // For each provided object, add those settings to the element
            for (i = 0; i < args.length; i += 1) {
                this.proliferateElement(element, arguments[i]);
            }

            return element;
        }

        /**
         * Identical to proliferate, but tailored for HTML elements because many
         * element attributes don't play nicely with JavaScript Array standards. 
         * Looking at you, HTMLCollection!
         * 
         * @param recipient   An HTMLElement to receive properties from the donor.
         * @param donor   An object do donoate properties to the recipient.
         * @param noOverride   Whether pre-existing properties of the recipient should 
         *                     be skipped (defaults to false).
         * @returns recipient
         */
        proliferateElement(recipient: HTMLElement, donor: any, noOverride: boolean = false): HTMLElement {
            var setting: any,
                i: string,
                j: number;

            // For each attribute of the donor:
            for (i in donor) {
                if (donor.hasOwnProperty(i)) {<commit_msg>Fix for createElement not proliferating first arg<commit_after>module TouchPassr {
    "use strict";

    /**
     * Abstract class for on-screen controls. Element creation for .element
     * and .elementInner within the constrained position is provided.
     */
    export class Control<T extends IControlSchema> {
        /**
         * The parent TouchPassr's InputWritr. Pipe events are sent through here.
         */
        protected InputWriter: InputWritr.IInputWritr;

        /**
         * The governing schema for this control. It should be overriden as a more
         * specific shema in child classes.
         */
        protected schema: T;

        /**
         * The outer container element. It should have width and height of 0, so
         * it can be positioned using the schema's .position.
         */
        protected element: HTMLElement;

        /**
         * The inner container element, directly inside the outer container. It
         * should be positioned absolutely so its center is the outer container.
         */
        protected elementInner: HTMLElement;

        /**
         * Resets the control by setting member variables and calling resetElement.
         * 
         * @param InputWriter   The parent TouchPassr's InputWritr.
         * @param schema   The governing schema for this control.
         * @param styles   Any styles to add to the element.
         */
        constructor(InputWriter: InputWritr.IInputWritr, schema: T, styles: IRootControlStyles) {
            this.InputWriter = InputWriter;
            this.schema = schema;
            this.resetElement(styles);
        }

        /**
         * @returns The outer container element.
         */
        getElement(): HTMLElement {
            return this.element;
        }

        /**
         * @returns The inner container element.
         */
        getElementInner(): HTMLElement {
            return this.elementInner;
        }

        /**
         * Creates and returns an HTMLElement of the specified type. Any additional
         * settings Objects may be given to be proliferated onto the Element via
         * proliferateElement.
         * 
         * @param type   The tag of the Element to be created.
         * @param settings   Additional settings for the Element, such as className 
         *                   or style.
         * @returns A newly created HTMLElement of the specified type.
         */
        createElement(tag: string, ...args: any[]): HTMLElement {
            var element: any = document.createElement(tag || "div"),
                i: number;

            // For each provided object, add those settings to the element
            for (i = 0; i < args.length; i += 1) {
                this.proliferateElement(element, args[i]);
            }

            return element;
        }

        /**
         * Identical to proliferate, but tailored for HTML elements because many
         * element attributes don't play nicely with JavaScript Array standards. 
         * Looking at you, HTMLCollection!
         * 
         * @param recipient   An HTMLElement to receive properties from the donor.
         * @param donor   An object do donoate properties to the recipient.
         * @param noOverride   Whether pre-existing properties of the recipient should 
         *                     be skipped (defaults to false).
         * @returns recipient
         */
        proliferateElement(recipient: HTMLElement, donor: any, noOverride: boolean = false): HTMLElement {
            var setting: any,
                i: string,
                j: number;

            // For each attribute of the donor:
            for (i in donor) {
                if (donor.hasOwnProperty(i)) {
{'fraction_non_alphanumeric': 0.07081774452164617, 'fraction_numerical': 0.0008017103153393907, 'mean_word_length': 1.7417582417582418, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '2709330', 'n_tokens_mistral': 1803, 'n_tokens_neox': 1732, 'n_words': 697}