Skip to content

Commit

Permalink
Expose setHtml function in mutable and immutable Node class
Browse files Browse the repository at this point in the history
  • Loading branch information
JonMcPherson committed Nov 20, 2023
1 parent c44a608 commit f80a883
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ package object mutable {

def replaceWith(in: Node[_ <: ParentState])(implicit ev: HasParent[A]): Unit =
node.underlying.replaceWith(in.underlying.clone)

def setHtml(html: String): Unit = node.underlying.html(html)
}

private[scalasoup] implicit class MutableTextNode[A <: ParentState](val node: TextNode[A]) extends AnyVal {
Expand Down
2 changes: 2 additions & 0 deletions dsl/src/main/scala/com/iterable/scalasoup/impl/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ package object impl {

def replaceWith(in: Node[_ <: ParentState])(implicit ev: HasParent[B]): Modification[Unit] =
modification(node, _.replaceWith(in))

def setHtml(html: String): Modification[Unit] = modification(node, _.setBaseUri(html))
}

class ElementDsl[B <: ParentState](val element: Element[B]) extends AnyVal {
Expand Down

0 comments on commit f80a883

Please sign in to comment.