<commit_before>export interface Offset {
  left: number;
  top: number;
}

/**
 * Simple DOM manipulation and DOM element event handling modeled after jQuery (as replacement for jQuery).
 *
 * Like jQuery, DOM operates on single elements and lists of elements. For example: creating an element returns a DOM
 * instance with a single element, selecting elements returns a DOM instance with zero, one, or many elements. Similar
 * to jQuery, setters usually affect all elements, while getters operate on only the first element.
 * Also similar to jQuery, most methods (except getters) return the DOM instance facilitating easy chaining of method
 * calls.
 *
 * Built with the help of: http://youmightnotneedjquery.com/
 */
export class DOM {

  private document: Document;

  /**
   * The list of elements that the instance wraps. Take care that not all methods can operate on the whole list,
   * getters usually just work on the first element.
   */
  private elements: HTMLElement[];

  /**
   * Creates a DOM element.
   * @param tagName the tag name of the DOM element
   * @param attributes a list of attributes of the element
   */
  constructor(tagName: string, attributes: {[name: string]: string});
  /**
   * Selects all elements from the DOM that match the specified selector.
   * @param selector the selector to match DOM elements with
   */
  constructor(selector: string);
  /**
   * Wraps a plain HTMLElement with a DOM instance.
   * @param element the HTMLElement to wrap with DOM
   */
  constructor(element: HTMLElement);
  /**
   * Wraps a list of plain HTMLElements with a DOM instance.
   * @param element the HTMLElements to wrap with DOM
   */
  constructor(elements: HTMLElement[]);
  /**
   * Wraps the document with a DOM instance. Useful to attach event listeners to the document.
   * @param document the document to wrap
   */
  constructor(document: Document);
  constructor(something: string | HTMLElement | HTMLElement[] | Document, attributes?: {[name: string]: string}) {
    this.document = document; // Set the global document to the local document field

    if (something instanceof Array) {
      if (something.length > 0 && something[0] instanceof HTMLElement) {
        let elements = something;
        this.elements = elements;
      }
    }
    else if (something instanceof HTMLElement) {
      let element = something;
      this.elements = [element];
    }
    else if (something instanceof Document) {
      // When a document is passed in, we do not do anything with it, but by setting this.elements to null
      // we give the event handling method a means to detect if the events should be registered on the document
      // instead of elements.
      this.elements = null;
    }
    else if (attributes) {<commit_msg>Fix documentation<commit_after>export interface Offset {
  left: number;
  top: number;
}

/**
 * Simple DOM manipulation and DOM element event handling modeled after jQuery (as replacement for jQuery).
 *
 * Like jQuery, DOM operates on single elements and lists of elements. For example: creating an element returns a DOM
 * instance with a single element, selecting elements returns a DOM instance with zero, one, or many elements. Similar
 * to jQuery, setters usually affect all elements, while getters operate on only the first element.
 * Also similar to jQuery, most methods (except getters) return the DOM instance facilitating easy chaining of method
 * calls.
 *
 * Built with the help of: http://youmightnotneedjquery.com/
 */
export class DOM {

  private document: Document;

  /**
   * The list of elements that the instance wraps. Take care that not all methods can operate on the whole list,
   * getters usually just work on the first element.
   */
  private elements: HTMLElement[];

  /**
   * Creates a DOM element.
   * @param tagName the tag name of the DOM element
   * @param attributes a list of attributes of the element
   */
  constructor(tagName: string, attributes: {[name: string]: string});
  /**
   * Selects all elements from the DOM that match the specified selector.
   * @param selector the selector to match DOM elements with
   */
  constructor(selector: string);
  /**
   * Wraps a plain HTMLElement with a DOM instance.
   * @param element the HTMLElement to wrap with DOM
   */
  constructor(element: HTMLElement);
  /**
   * Wraps a list of plain HTMLElements with a DOM instance.
   * @param elements the HTMLElements to wrap with DOM
   */
  constructor(elements: HTMLElement[]);
  /**
   * Wraps the document with a DOM instance. Useful to attach event listeners to the document.
   * @param document the document to wrap
   */
  constructor(document: Document);
  constructor(something: string | HTMLElement | HTMLElement[] | Document, attributes?: {[name: string]: string}) {
    this.document = document; // Set the global document to the local document field

    if (something instanceof Array) {
      if (something.length > 0 && something[0] instanceof HTMLElement) {
        let elements = something;
        this.elements = elements;
      }
    }
    else if (something instanceof HTMLElement) {
      let element = something;
      this.elements = [element];
    }
    else if (something instanceof Document) {
      // When a document is passed in, we do not do anything with it, but by setting this.elements to null
      // we give the event handling method a means to detect if the events should be registered on the document
      // instead of elements.
      this.elements = null;
    }
    else if (attributes) {
{'fraction_non_alphanumeric': 0.07707545470916621, 'fraction_numerical': 0.0007203313524221142, 'mean_word_length': 3.2592024539877302, 'pattern_counts': {'":': 0, '<': 3, '<?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': '710174', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1411, 'n_words': 685}