<commit_before>function WizardTags(element_query, options) {
	var LIST_UPDATE_TIMEOUT = 300;

	options = options || {};

	var TagsGenerator = function() {
		return [];
	};
	if (options.tags instanceof Function) {
		TagsGenerator = options.tags;
	} else if (options.tags instanceof Array) {
		TagsGenerator = function(query) {
			return options.tags.filter(
				function(tag) {
					return tag.substr(0, query.length) == query;
				}
			);
		};
	}

	var root = document.querySelector(element_query);
	root.className = 'wizard-tags';

	var list = null;
	var CreateList = function(query) {
		list = document.createElement('ul');
		list.className = 'wizard-tags-autocomplete-list';
		if (typeof options.list_maximal_height !== "undefined") {
			list.style.maxHeight = options.list_maximal_height + 'px';
		}

		var tags = TagsGenerator(query);
		for (var i = 0; i < tags.length; i++) {
			var text = tags[i];

			var item = document.createElement('li');
			item.innerText = text;
			item.addEventListener(
				'click',
				function() {
					AddTag(text);
				}
			);

			list.appendChild(item);
		}

		root.appendChild(list);
	};
	var RemoveList = function() {
		root.removeChild(list);
	};

	var input = document.createElement('input');
	input.addEventListener(
		'focus',
		function() {
			CreateList(input.value);
		}
	);
	var list_update_timer = null;
	input.addEventListener(
		'keyup',
		function() {
			clearTimeout(list_update_timer);
			list_update_timer = setTimeout(
				function() {
					RemoveList();
					CreateList(input.value);
				},
				LIST_UPDATE_TIMEOUT
			);
		}
	);
	input.addEventListener('blur', RemoveList);
	root.appendChild(input);
<commit_msg>Correct of list removing; correct of tag addition.<commit_after>function WizardTags(element_query, options) {
	var LIST_UPDATE_TIMEOUT = 300;

	options = options || {};

	var TagsGenerator = function() {
		return [];
	};
	if (options.tags instanceof Function) {
		TagsGenerator = options.tags;
	} else if (options.tags instanceof Array) {
		TagsGenerator = function(query) {
			return options.tags.filter(
				function(tag) {
					return tag.substr(0, query.length) == query;
				}
			);
		};
	}

	var root = document.querySelector(element_query);
	root.className = 'wizard-tags';

	var list = null;
	var CreateList = function(query) {
		list = document.createElement('ul');
		list.className = 'wizard-tags-autocomplete-list';
		if (typeof options.list_maximal_height !== "undefined") {
			list.style.maxHeight = options.list_maximal_height + 'px';
		}

		var tags = TagsGenerator(query);
		for (var i = 0; i < tags.length; i++) {
			var text = tags[i];

			var item = document.createElement('li');
			item.innerText = text;
			item.addEventListener(
				'click',
				function() {
					AddTag(this.innerText);
				}
			);

			list.appendChild(item);
		}

		root.appendChild(list);
	};
	var RemoveList = function() {
		root.removeChild(list);
	};

	var input = document.createElement('input');
	input.addEventListener(
		'focus',
		function() {
			CreateList(input.value);
		}
	);
	var list_update_timer = null;
	input.addEventListener(
		'keyup',
		function() {
			clearTimeout(list_update_timer);
			list_update_timer = setTimeout(
				function() {
					RemoveList();
					CreateList(input.value);
				},
				LIST_UPDATE_TIMEOUT
			);
		}
	);
	input.addEventListener(
		'blur',
		function() {
			setTimeout(RemoveList, 1);
		}
	);
	root.appendChild(input);

{'fraction_non_alphanumeric': 0.14214827787507298, 'fraction_numerical': 0.003210741389375365, 'mean_word_length': 3.618598382749326, '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': '2620231', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1106, 'n_words': 220}