<commit_before>class Capybara::RackTest::Node < Capybara::Driver::Node
  def text
    native.text
  end

  def [](name)
    string_node[name]
  end

  def value
    string_node.value
  end

  def set(value)
    if tag_name == 'input' and type == 'radio'
      other_radios_xpath = XPath.generate { |x| x.anywhere(:input)[x.attr(:name).equals(self[:name])] }.to_s
      driver.dom.xpath(other_radios_xpath).each { |node| node.remove_attribute("checked") }
      native['checked'] = 'checked'
    elsif tag_name == 'input' and type == 'checkbox'
      if value && !native['checked']
        native['checked'] = 'checked'
      elsif !value && native['checked']
        native.remove_attribute('checked')
      end
    elsif tag_name == 'input'
      if (type == 'text' || type == 'password') && self[:maxlength]
        value = value[0...self[:maxlength].to_i]
      end
      native['value'] = value.to_s
    elsif tag_name == "textarea"
      native.content = value.to_s
    end
  end

  def select_option
    if select_node['multiple'] != 'multiple'
      select_node.find(".//option[@selected]").each { |node| node.native.remove_attribute("selected") }
    end
    native["selected"] = 'selected'
  end

  def unselect_option
    if select_node['multiple'] != 'multiple'
      raise Capybara::UnselectNotAllowed, "Cannot unselect option from single select box."
    end
    native.remove_attribute('selected')
  end

  def click
    if tag_name == 'a'
      method = self["data-method"] || :get
      driver.follow(method, self[:href].to_s)
    elsif (tag_name == 'input' and %w(submit image).include?(type)) or
        ((tag_name == 'button') and type.nil? or type == "submit")
      Capybara::RackTest::Form.new(driver, form).submit(self)
    end
  end

  def tag_name
    native.node_name
  end

  def visible?
    string_node.visible?
  end<commit_msg>Fix because chromedriver + Chrome 12 YELLS tag names in UPPERCASE<commit_after>class Capybara::RackTest::Node < Capybara::Driver::Node
  def text
    native.text
  end

  def [](name)
    string_node[name]
  end

  def value
    string_node.value
  end

  def set(value)
    if tag_name == 'input' and type == 'radio'
      other_radios_xpath = XPath.generate { |x| x.anywhere(:input)[x.attr(:name).equals(self[:name])] }.to_s
      driver.dom.xpath(other_radios_xpath).each { |node| node.remove_attribute("checked") }
      native['checked'] = 'checked'
    elsif tag_name == 'input' and type == 'checkbox'
      if value && !native['checked']
        native['checked'] = 'checked'
      elsif !value && native['checked']
        native.remove_attribute('checked')
      end
    elsif tag_name == 'input'
      if (type == 'text' || type == 'password') && self[:maxlength]
        value = value[0...self[:maxlength].to_i]
      end
      native['value'] = value.to_s
    elsif tag_name == "textarea"
      native.content = value.to_s
    end
  end

  def select_option
    if select_node['multiple'] != 'multiple'
      select_node.find(".//option[@selected]").each { |node| node.native.remove_attribute("selected") }
    end
    native["selected"] = 'selected'
  end

  def unselect_option
    if select_node['multiple'] != 'multiple'
      raise Capybara::UnselectNotAllowed, "Cannot unselect option from single select box."
    end
    native.remove_attribute('selected')
  end

  def click
    if tag_name == 'a'
      method = self["data-method"] || :get
      driver.follow(method, self[:href].to_s)
    elsif (tag_name == 'input' and %w(submit image).include?(type)) or
        ((tag_name == 'button') and type.nil? or type == "submit")
      Capybara::RackTest::Form.new(driver, form).submit(self)
    end
  end

  def tag_name
    native.node_name.downcase
  end

  def visible?
    string_node.visible?
  end
{'fraction_non_alphanumeric': 0.1440296531638867, 'fraction_numerical': 0.0010590415673815197, 'mean_word_length': 3.1792035398230087, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7224056', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1226, 'n_words': 280}