<commit_before>/**
 * @fileoverview DOM helper functions.
 */

goog.provide('treesaver.dom');

goog.require('treesaver.array');
goog.require('treesaver.scheduler');

goog.scope(function() {
  var dom = treesaver.dom,
      array = treesaver.array,
      scheduler = treesaver.scheduler;

  // Mozilla doesn't support element.contains()
  if ('Node' in window && Node.prototype && !'contains' in Node.prototype) {
    // Fix from PPK
    // http://www.quirksmode.org/blog/archives/2006/01/contains_for_mo.html
    Node.prototype.contains = function(arg) {
      return !!(this.compareDocumentPosition(arg) & 16);
    };
  }

  // Check for classList support, which makes things much simpler
  if ('classList' in document.documentElement) {
    /**
     * Add a CSS class to an element
     *
     * @param {!Element} el
     * @param {!string} className
     */
    dom.addClass = function(el, className) {
      className.split(/\s+/).forEach(function(name) {
        el.classList.add(name);
      });
    };

    /**
     * Remove a CSS class to an element
     *
     * @param {!Element} el
     * @param {!string} className
     */
    dom.removeClass = function(el, className) {<commit_msg>Fix a stupid detection mistake when patching Node.contains for Firefox<commit_after>/**
 * @fileoverview DOM helper functions.
 */

goog.provide('treesaver.dom');

goog.require('treesaver.array');
goog.require('treesaver.scheduler');

goog.scope(function() {
  var dom = treesaver.dom,
      array = treesaver.array,
      scheduler = treesaver.scheduler;

  // Mozilla doesn't support element.contains()
  if ('Node' in window && Node.prototype && !('contains' in Node.prototype)) {
    // Fix from PPK
    // http://www.quirksmode.org/blog/archives/2006/01/contains_for_mo.html
    Node.prototype.contains = function(arg) {
      return !!(this.compareDocumentPosition(arg) & 16);
    };
  }

  // Check for classList support, which makes things much simpler
  if ('classList' in document.documentElement) {
    /**
     * Add a CSS class to an element
     *
     * @param {!Element} el
     * @param {!string} className
     */
    dom.addClass = function(el, className) {
      className.split(/\s+/).forEach(function(name) {
        el.classList.add(name);
      });
    };

    /**
     * Remove a CSS class to an element
     *
     * @param {!Element} el
     * @param {!string} className
     */
    dom.removeClass = function(el, className) {
{'fraction_non_alphanumeric': 0.14507560277891296, 'fraction_numerical': 0.006538618716796077, 'mean_word_length': 2.807153965785381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6561684', 'n_tokens_mistral': 778, 'n_tokens_neox': 742, 'n_words': 177}