<commit_before>/*
==================================================================================================
  Core - JavaScript Foundation
  Copyright 2013 <NAME>
==================================================================================================
*/

"use strict";

(function(document, undefined)
{
  var hasPointerEvents = document.onpointerdown !== undefined || document.onmspointerdown !== undefined;
  var hasTouchEvents = document.ontouchstart !== undefined;
  var hasMouseEvents = document.documentElement.onmousedown !== undefined
  var hasMouseEnterLeaveEvents = document.onmouseenter || document.onmouseleave;

  var special = {
    tap : core.bom.TapEvent
  }

  /** {=Map} Map of all event types supported */
  var supportedPointerEvents = core.Array.toKeys([
    "down", "up", "move", "over", "out", "cancel", "enter", "leave"
  ], true);

  if (jasy.Env.isSet("debug"))
  {
    var checkSignature = function(target, type, callback, context, capture) 
    {
      if (target == null) {
        throw new Error("Invalid targrt");
      }

      core.Assert.isType(type, "String");

      if (!supportedPointerEvents[type]) {
        throw new Error("Unsupported event: " + type);
      }

      core.Assert.isType(callback, "Function");

      if (context != null) {
        core.Assert.isType(context, "String");  
      }

      if (capture != null) {
        core.Assert.isType(capture, "Boolean");  
      }
    };    
  }

  /**
   * Pointer Events API for dealing with down/up/move events.
   *
   * Still work in progress.
   */
  core.Module("core.bom.PointerEventsNext",
  {
    has : function(target, type, callback, context, capture)
    {
      var specialHandler = special[type];
      if (specialHandler) {
        return specialHandler.remove(target, type, callback, context, capture);
      }

      // Input parameter validation
      if (jasy.Env.isSet("debug")) {
        checkSignature(target, type, callback, context, capture);
      }

      // Hard-wire context to function, re-use existing bound functions
      if (context) {
        callback = core.Function.bind(callback, context);
      }

      // Check for listener existance
      var eventId = core.bom.event.Util.getId(type, callback, capture);
      return !!target[eventId];
    },


    add : function(target, type, callback, context, capture) 
    {
      var specialHandler = special[type];
      if (specialHandler) {
        return specialHandler.add(target, type, callback, context, capture);
      }

      // Input parameter validation
      if (jasy.Env.isSet("debug")) {
        checkSignature(target, type, callback, context, capture);
      }

      // Hard-wire context to function, re-use existing bound functions
      if (context) {
        callback = core.Function.bind(callback, context);
      }

      // Lookup entry
      var eventId = core.bom.event.Util.getId(type, callback, capture);
      var listeners = core.bom.event.Util.create(target, eventId);

      // Full event name to fire
      var pointerType = "pointer" + type;

      // Mouse support
      if (hasMouseEvents)
      {
        var nativeType = "mouse" + type;
        if (hasMouseEnterLeaveEvents && (nativeType == "mouseenter" || nativeType == "mouseleave")) {
          nativeType = nativeType == "mouseenter" ? "mouseover" : "mouseout";
        }
<commit_msg>Fixed tap event detection. Disabled mouse events for touch.<commit_after>/*
==================================================================================================
  Core - JavaScript Foundation
  Copyright 2013 <NAME>
==================================================================================================
*/

"use strict";

(function(document, undefined)
{
  var hasPointerEvents = document.onpointerdown !== undefined || document.onmspointerdown !== undefined;
  var hasTouchEvents = document.ontouchstart !== undefined;
  var hasMouseEvents = !hasPointerEvents && !hasTouchEvents;
  var hasMouseEnterLeaveEvents = document.onmouseenter || document.onmouseleave;

  var special = {
    tap : core.bom.TapEvent
  }

  /** {=Map} Map of all event types supported */
  var supportedPointerEvents = core.Array.toKeys([
    "down", "up", "move", "over", "out", "cancel", "enter", "leave"
  ], true);

  if (jasy.Env.isSet("debug"))
  {
    var checkSignature = function(target, type, callback, context, capture) 
    {
      if (target == null) {
        throw new Error("Invalid targrt");
      }

      core.Assert.isType(type, "String");

      if (!supportedPointerEvents[type]) {
        throw new Error("Unsupported event: " + type);
      }

      core.Assert.isType(callback, "Function");

      if (context != null) {
        core.Assert.isType(context, "String");  
      }

      if (capture != null) {
        core.Assert.isType(capture, "Boolean");  
      }
    };    
  }

  /**
   * Pointer Events API for dealing with down/up/move events.
   *
   * Still work in progress.
   */
  core.Module("core.bom.PointerEventsNext",
  {
    has : function(target, type, callback, context, capture)
    {
      var specialHandler = special[type];
      if (specialHandler) {
        return specialHandler.remove(target, type, callback, context, capture);
      }

      // Input parameter validation
      if (jasy.Env.isSet("debug")) {
        checkSignature(target, type, callback, context, capture);
      }

      // Hard-wire context to function, re-use existing bound functions
      if (context) {
        callback = core.Function.bind(callback, context);
      }

      // Check for listener existance
      var eventId = core.bom.event.Util.getId(type, callback, capture);
      return !!target[eventId];
    },


    add : function(target, type, callback, context, capture) 
    {
      var specialHandler = special[type];
      if (specialHandler) {
        return specialHandler.add(target, type, callback, context, capture);
      }

      // Input parameter validation
      if (jasy.Env.isSet("debug")) {
        checkSignature(target, type, callback, context, capture);
      }

      // Hard-wire context to function, re-use existing bound functions
      if (context) {
        callback = core.Function.bind(callback, context);
      }

      // Lookup entry
      var eventId = core.bom.event.Util.getId(type, callback, capture);
      var listeners = core.bom.event.Util.create(target, eventId);

      // Full event name to fire
      var pointerType = "pointer" + type;

      // Mouse support
      if (hasMouseEvents && !hasTouchEvents)
      {
        var nativeType = "mouse" + type;
        if (hasMouseEnterLeaveEvents && (nativeType == "mouseenter" || nativeType == "mouseleave")) {
          nativeType = nativeType == "mouseenter" ? "mouseover" : "mouseout";
        }

{'fraction_non_alphanumeric': 0.17838235294117646, 'fraction_numerical': 0.001176470588235294, 'mean_word_length': 2.892959358900973, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4218041', 'n_tokens_mistral': 1894, 'n_tokens_neox': 1824, 'n_words': 473}