<commit_before>// Copyright (c) 2013 Titanium I.T. LLC. All rights reserved. See LICENSE.txt for details.
/*global $, jQuery, TouchList, Touch */

(function() {
	"use strict";

	var HtmlElement = module.exports = function(jqueryElement) {
		this._element = jqueryElement;
	};

	HtmlElement.fromHtml = function(html) {
		return new HtmlElement($(html));
	};

	HtmlElement.prototype.append = function(elementToAppend) {
		this._element.append(elementToAppend._element);
	};

	HtmlElement.prototype.appendSelfToBody = function() {
		$(document.body).append(this._element);
	};

	HtmlElement.prototype.remove = function() {
		this._element.remove();
	};

	HtmlElement.prototype.toDomElement = function() {
		return this._element[0];
	};

	HtmlElement.prototype.doSelectStart = doMouseEventFn("selectstart");
	HtmlElement.prototype.doMouseDown = doMouseEventFn("mousedown");
	HtmlElement.prototype.doMouseMove = doMouseEventFn("mousemove");
	HtmlElement.prototype.doMouseLeave = doMouseEventFn("mouseleave");
	HtmlElement.prototype.doMouseUp = doMouseEventFn("mouseup");

	function doMouseEventFn(event) {
		return function(relativeX, relativeY) {
			sendMouseEvent(this, event, relativeX, relativeY);
		};
	}

	function sendMouseEvent(self, event, relativeX, relativeY) {
		var jqElement = self._element;

		var page = pageOffset(self, relativeX, relativeY);
		var eventData = new jQuery.Event();
		eventData.pageX = page.x;
		eventData.pageY = page.y;
		eventData.type = event;
		jqElement.trigger(eventData);
	}



	HtmlElement.prototype.doSingleTouchStart = function(relativeX, relativeY) {
		sendSingleTouchEvent(this, "touchstart", relativeX, relativeY);
	};

	HtmlElement.prototype.doSingleTouchMove = function(relativeX, relativeY) {
		sendSingleTouchEvent(this, "touchmove", relativeX, relativeY);
	};

	HtmlElement.prototype.doSingleTouchEnd = function(relativeX, relativeY) {
		sendSingleTouchEvent(this, "touchend", relativeX, relativeY);
	};

	HtmlElement.prototype.doSingleTouchCancel = function(relativeX, relativeY) {
		sendSingleTouchEvent(this, "touchcancel", relativeX, relativeY);
	};

	HtmlElement.prototype.doMultiTouchStart = function(relative1X, relative1Y, relative2X, relative2Y) {
		sendMultiTouchEvent(this, "touchstart", relative1X, relative1Y, relative2X, relative2Y);
	};

	HtmlElement.prototype.onSelectStart_ie8Only = function(callback) {
		this._element.on("selectstart", mouseEventHandlerFn(this, callback));
	};

	HtmlElement.prototype.onMouseDown = function(callback) {
		this._element.mousedown(mouseEventHandlerFn(this, callback));
	};

	HtmlElement.prototype.onMouseMove = function(callback) {<commit_msg>Simplified code to send single-touch events<commit_after>// Copyright (c) 2013 Titanium I.T. LLC. All rights reserved. See LICENSE.txt for details.
/*global $, jQuery, TouchList, Touch */

(function() {
	"use strict";

	var HtmlElement = module.exports = function(jqueryElement) {
		this._element = jqueryElement;
	};

	HtmlElement.fromHtml = function(html) {
		return new HtmlElement($(html));
	};

	HtmlElement.prototype.append = function(elementToAppend) {
		this._element.append(elementToAppend._element);
	};

	HtmlElement.prototype.appendSelfToBody = function() {
		$(document.body).append(this._element);
	};

	HtmlElement.prototype.remove = function() {
		this._element.remove();
	};

	HtmlElement.prototype.toDomElement = function() {
		return this._element[0];
	};

	HtmlElement.prototype.doSelectStart = doMouseEventFn("selectstart");
	HtmlElement.prototype.doMouseDown = doMouseEventFn("mousedown");
	HtmlElement.prototype.doMouseMove = doMouseEventFn("mousemove");
	HtmlElement.prototype.doMouseLeave = doMouseEventFn("mouseleave");
	HtmlElement.prototype.doMouseUp = doMouseEventFn("mouseup");

	function doMouseEventFn(event) {
		return function(relativeX, relativeY) {
			sendMouseEvent(this, event, relativeX, relativeY);
		};
	}

	function sendMouseEvent(self, event, relativeX, relativeY) {
		var jqElement = self._element;

		var page = pageOffset(self, relativeX, relativeY);
		var eventData = new jQuery.Event();
		eventData.pageX = page.x;
		eventData.pageY = page.y;
		eventData.type = event;
		jqElement.trigger(eventData);
	}


	HtmlElement.prototype.doSingleTouchStart = doSingleTouchEventFn("touchstart");
	HtmlElement.prototype.doSingleTouchMove = doSingleTouchEventFn("touchmove");
	HtmlElement.prototype.doSingleTouchEnd = doSingleTouchEventFn("touchend");
	HtmlElement.prototype.doSingleTouchCancel = doSingleTouchEventFn("touchcancel");


	function doSingleTouchEventFn(event) {
		return function(relativeX, relativeY) {
			sendSingleTouchEvent(this, event, relativeX, relativeY);
		};
	}

	HtmlElement.prototype.doMultiTouchStart = function(relative1X, relative1Y, relative2X, relative2Y) {
		sendMultiTouchEvent(this, "touchstart", relative1X, relative1Y, relative2X, relative2Y);
	};

	HtmlElement.prototype.onSelectStart_ie8Only = function(callback) {
		this._element.on("selectstart", mouseEventHandlerFn(this, callback));
	};

	HtmlElement.prototype.onMouseDown = function(callback) {
		this._element.mousedown(mouseEventHandlerFn(this, callback));
	};

	HtmlElement.prototype.onMouseMove = function(callback) {
{'fraction_non_alphanumeric': 0.12350674373795761, 'fraction_numerical': 0.005394990366088632, 'mean_word_length': 6.081855388813097, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4793099', 'n_tokens_mistral': 1673, 'n_tokens_neox': 1572, 'n_words': 270}