<commit_before>import { components, data, setViewNew, viewCurrent, viewNew, viewOld } from "../util/globals";
import { types } from "../util/util";

/**
 * Start time
 */
let executeStart;

/**
 * Types of patches
 */
const patchTypes = {
	setAttributes: 0,
	appendElement: 1,
	removeElement: 2,
	replaceElement: 3
};

/**
 * Creates a DOM element from a view node.
 *
 * @param {Object} node
 * @returns {Element} DOM element
 */
function executeCreateElement(node) {
	if (node.type === types.element) {
		const element = document.createElement(node.name);
		const data = node.data;
		const children = data.children;

		for (let key in data) {
			element.setAttribute(key, data[key]);
		}

		for (let i = 0; i < children.length; i++) {
			element.appendChild(executeCreateElement(children[i]));
		}

		return element;
	} else {
		return document.createTextNode(node.data[""]);
	}
}

/**<commit_msg>dont set children attribute<commit_after>import { components, data, setViewNew, viewCurrent, viewNew, viewOld } from "../util/globals";
import { types } from "../util/util";

/**
 * Start time
 */
let executeStart;

/**
 * Types of patches
 */
const patchTypes = {
	setAttributes: 0,
	appendElement: 1,
	removeElement: 2,
	replaceElement: 3
};

/**
 * Creates a DOM element from a view node.
 *
 * @param {Object} node
 * @returns {Element} DOM element
 */
function executeCreate(node) {
	if (node.type === types.element) {
		const element = document.createElement(node.name);
		const data = node.data;
		const children = data.children;

		for (let key in data) {
			if (key !== "children") {
				element.setAttribute(key, data[key]);
			}
		}

		for (let i = 0; i < children.length; i++) {
			element.appendChild(executeCreateElement(children[i]));
		}

		return element;
	} else {
		return document.createTextNode(node.data[""]);
	}
}

/**
{'fraction_non_alphanumeric': 0.15271739130434783, 'fraction_numerical': 0.005434782608695652, 'mean_word_length': 3.6844783715012723, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4109342', 'n_tokens_mistral': 634, 'n_tokens_neox': 588, 'n_words': 164}