<commit_before>/**
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
 * Licensed under the LGPL or a commercial license.
 * For LGPL see License.txt in the project root for license information.
 * For commercial licenses see https://www.tiny.cloud/
 */

import { document, HTMLElementEventMap, MouseEvent, window } from '@ephox/dom-globals';
import { Obj } from '@ephox/katamari';

export type EventUtilsCallback<T> = (event: EventUtilsEvent<T>) => void;

interface PartialEvent {
  type: string;
  target?: any;
  isDefaultPrevented?: () => boolean;
  preventDefault?: () => void;
  isPropagationStopped?: () => boolean;
  stopPropagation?: () => void;
  isImmediatePropagationStopped?: () => boolean;
  stopImmediatePropagation?: () => void;
  returnValue?: boolean;
  cancelBubble?: boolean;
}

export type EventUtilsEvent<T> = T & {
  type: string;
  target: any;
  readonly isDefaultPrevented: () => boolean;
  readonly preventDefault: () => void;
  readonly isPropagationStopped: () => boolean;
  readonly stopPropagation: () => void;
  readonly isImmediatePropagationStopped: () => boolean;
  readonly stopImmediatePropagation: () => void;
};

/**
 * This class wraps the browsers native event logic with more convenient methods.
 *
 * @class tinymce.dom.EventUtils
 */

const eventExpandoPrefix = 'mce-data-';
const mouseEventRe = /^(?:mouse|contextmenu)|click/;
const deprecated = {
  keyLocation: 1, layerX: 1, layerY: 1, returnValue: 1,
  webkitMovementX: 1, webkitMovementY: 1, keyIdentifier: 1, mozPressure: 1
};

// Checks if it is our own isDefaultPrevented function
const hasIsDefaultPrevented = function (event) {
  return event.isDefaultPrevented === returnTrue || event.isDefaultPrevented === returnFalse;
};<commit_msg>Add composedPath to PartialEvent interface.<commit_after>/**
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
 * Licensed under the LGPL or a commercial license.
 * For LGPL see License.txt in the project root for license information.
 * For commercial licenses see https://www.tiny.cloud/
 */

import { document, EventTarget, HTMLElementEventMap, MouseEvent, window } from '@ephox/dom-globals';
import { Obj } from '@ephox/katamari';

export type EventUtilsCallback<T> = (event: EventUtilsEvent<T>) => void;

interface PartialEvent {
  type: string;
  target?: any;
  isDefaultPrevented?: () => boolean;
  preventDefault?: () => void;
  isPropagationStopped?: () => boolean;
  stopPropagation?: () => void;
  isImmediatePropagationStopped?: () => boolean;
  stopImmediatePropagation?: () => void;
  returnValue?: boolean;
  cancelBubble?: boolean;
  composedPath?: () => EventTarget[];
}

export type EventUtilsEvent<T> = T & {
  type: string;
  target: any;
  readonly isDefaultPrevented: () => boolean;
  readonly preventDefault: () => void;
  readonly isPropagationStopped: () => boolean;
  readonly stopPropagation: () => void;
  readonly isImmediatePropagationStopped: () => boolean;
  readonly stopImmediatePropagation: () => void;
};

/**
 * This class wraps the browsers native event logic with more convenient methods.
 *
 * @class tinymce.dom.EventUtils
 */

const eventExpandoPrefix = 'mce-data-';
const mouseEventRe = /^(?:mouse|contextmenu)|click/;
const deprecated = {
  keyLocation: 1, layerX: 1, layerY: 1, returnValue: 1,
  webkitMovementX: 1, webkitMovementY: 1, keyIdentifier: 1, mozPressure: 1
};

// Checks if it is our own isDefaultPrevented function
const hasIsDefaultPrevented = function (event) {
  return event.isDefaultPrevented === returnTrue || event.isDefaultPrevented === returnFalse;
};
{'fraction_non_alphanumeric': 0.12810493999441808, 'fraction_numerical': 0.004465531677365337, 'mean_word_length': 4.92396694214876, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 36, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '7146410', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1085, 'n_words': 313}