Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions dom/src/main/scala/com/thoughtworks/binding/dom.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import scala.language.experimental.macros
import scalatags.JsDom
import scalatags.jsdom
import org.scalajs.dom.document
import scalatags.JsDom.TypedTag
import scalatags.generic.Namespace

import scala.collection.immutable.Queue
import scala.reflect.NameTransformer
Expand Down Expand Up @@ -144,14 +146,16 @@ object dom {

import scala.language.dynamics

object raw extends Dynamic {

final class DynamicDataTag private[TagsAndTags2] ()
extends TypedTag[HTMLElement]("data", Nil, false, Namespace.htmlNamespaceConfig)
with Dynamic {
final def selectDynamic(tagName: String): ConcreteHtmlTag[Element] = {
tag(tagName)
TagsAndTags2.tag(tagName)
}

}

override lazy val data = new DynamicDataTag()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good hack 👍
If you like it, I like too 😄


}

@inline
Expand Down
2 changes: 1 addition & 1 deletion dom/src/test/scala/com/thoughtworks/binding/domTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ final class domTest extends FreeSpec with Matchers {

"CustomTag" in {
@dom def tag = {
<raw:custom-tag local-id="customTag" id="custom" data:custom-key="value"><data id="123">{customTag.tagName}</data></raw:custom-tag>
<data:custom-tag local-id="customTag" id="custom" data:custom-key="value"><data id="123">{customTag.tagName}</data></data:custom-tag>
}
val div = document.createElement("div")
dom.render(div, tag)
Expand Down