<commit_before>package im.mange.jetpac.html

import im.mange.jetpac.event.EventHandling
import im.mange.jetpac.{Event, Styleable, Renderable}
import net.liftweb.http.js.JsCmd

//TODO: okay, theses are definitely all Elements

case class Th(content: Renderable) extends Renderable with Styleable {
  def render = <th class={classes.render} style={styles.render}>{content.render}</th>
}

case class Td(content: Renderable) extends Renderable with Styleable {
  def render = <td class={classes.render} style={styles.render}>{content.render}</td>
}

case class Tr(id: Option[String] ,content: Renderable) extends Renderable with Styleable with EventHandling {
  def baseElement = <tr id={id.getOrElse("")} class={classes.render} style={styles.render}>{content.render}</tr>

  def onClick(handler: String => JsCmd): this.type = addEvents(Event.onClick -> handler)
}
<commit_msg>make it possible for TD's to have attributes<commit_after>package im.mange.jetpac.html

import im.mange.jetpac.event.EventHandling
import im.mange.jetpac.{HasAttributes, Event, Styleable, Renderable}
import net.liftweb.http.js.JsCmd
import net.liftweb.http.SHtml.ElemAttr


//TODO: okay, theses are definitely all Elements

case class Th(content: Renderable) extends Renderable with Styleable {
  def render = <th class={classes.render} style={styles.render}>{content.render}</th>
}

case class Td(content: Renderable) extends Renderable with Styleable with HasAttributes {
  def render = {
    val allAttributes: Seq[(String, String)] = Map("style" → styles.render, "class" → classes.render).toSeq ++ attributes.toSeq
    val elemAttrs = ElemAttr.strSeqToElemAttr(allAttributes)
    val base = <td>{content.render}</td>
    elemAttrs.foldLeft(base)(_ % _)
  }
}

case class Tr(id: Option[String] ,content: Renderable) extends Renderable with Styleable with EventHandling {
  def baseElement = <tr id={id.getOrElse("")} class={classes.render} style={styles.render}>{content.render}</tr>

  def onClick(handler: String => JsCmd): this.type = addEvents(Event.onClick -> handler)
}

{'fraction_non_alphanumeric': 0.12914230019493178, 'fraction_numerical': 0.0, 'mean_word_length': 5.517460317460317, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '3741322', 'n_tokens_mistral': 654, 'n_tokens_neox': 650, 'n_words': 163}