<commit_before>/**
 * there is the form-elements additional methods container
 *
 * Copyright (C) 2009 <NAME> aka St. <nemshilov#gma-ilc-om>
 */
Form.Element = {
  /**
   * IE browsers manual elements extending
   *
   * @param Element element
   * @return Element extended element
   */
  ext: function(element) {
    // highjack the native methods to be able to call them froum our wrappers
    element._blur   = element.blur;
    element._focus  = element.focus;
    element._select = element.select;
    
    return $ext(element, this.Methods);
  },
  
  Methods: {
   /**
    * uniform access to the element values
    *
    * @return String element value
    */
    getValue: function() {
      if (this.type == 'select-multiple') {
        return $A(this.childNodes).map(function(option) {
          return option.selected ? option.value : null;
        }).compact();
      } else {
        return this.value;
      }
    },

    /**
    * uniform accesss to set the element value
    *
    * @param String value
    * @return Element this
    */
    setValue: function(value) {
      if (this.type == 'select-multiple') {
        value = (isArray(value) ? value : [value]).map(String);
        $A(this.childNodes).each(function(option) {
          option.selected = value.includes(option.value);
        });
      } else {
        this.value = value;
      }
      return this;
    },

    /**
     * makes the element disabled
     *
     * @return Element this
     */<commit_msg>Form.Element multiselect units handling improvements<commit_after>/**
 * there is the form-elements additional methods container
 *
 * Copyright (C) 2009 <NAME> aka St. <nemshilov#gma-ilc-om>
 */
Form.Element = {
  /**
   * IE browsers manual elements extending
   *
   * @param Element element
   * @return Element extended element
   */
  ext: function(element) {
    // highjack the native methods to be able to call them froum our wrappers
    element._blur   = element.blur;
    element._focus  = element.focus;
    element._select = element.select;
    
    return $ext(element, this.Methods);
  },
  
  Methods: {
   /**
    * uniform access to the element values
    *
    * @return String element value
    */
    getValue: function() {
      if (this.type == 'select-multiple') {
        return $A(this.getElementsByTagName('option')).map(function(option) {
          return option.selected ? option.value : null;
        }).compact();
      } else {
        return this.value;
      }
    },

    /**
    * uniform accesss to set the element value
    *
    * @param String value
    * @return Element this
    */
    setValue: function(value) {
      if (this.type == 'select-multiple') {
        value = (isArray(value) ? value : [value]).map(String);
        $A(this.getElementsByTagName('option')).each(function(option) {
          option.selected = value.includes(option.value);
        });
      } else {
        this.value = value;
      }
      return this;
    },

    /**
     * makes the element disabled
     *
     * @return Element this
     */
{'fraction_non_alphanumeric': 0.12520431513566524, 'fraction_numerical': 0.002615233736515201, 'mean_word_length': 2.200836820083682, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4704163', 'n_tokens_mistral': 911, 'n_tokens_neox': 888, 'n_words': 234}