File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
core/src/main/scala/japgolly/scalajs/react/vdom Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11package japgolly .scalajs .react .vdom
22
3- import japgolly .scalajs .react .{raw => Raw }
3+ import japgolly .scalajs .react .{Callback , raw => Raw }
44import scala .scalajs .js
55
66sealed class VdomNode (val rawNode : Raw .ReactNode ) extends TagMod {
@@ -18,7 +18,10 @@ object VdomNode {
1818
1919// =====================================================================================================================
2020
21- final class VdomElement (val rawElement : Raw .ReactElement ) extends VdomNode (rawElement)
21+ final class VdomElement (val rawElement : Raw .ReactElement ) extends VdomNode (rawElement) {
22+ def renderIntoDOM (container : Raw .ReactDOM .Container , callback : Callback = Callback .empty): Raw .ReactComponentUntyped =
23+ Raw .ReactDOM .render(rawElement, container, callback.toJsFn)
24+ }
2225
2326object VdomElement {
2427 def apply (n : Raw .ReactElement ): VdomElement =
Original file line number Diff line number Diff line change 11package japgolly .scalajs .react .vdom
22
3+ import japgolly .scalajs .react .{Callback , raw => Raw }
4+
35class TagOf [+ N <: TopNode ] private [vdom](final val tag : String ,
46 final protected val modifiers : List [Seq [TagMod ]],
57 final val namespace : Namespace ) extends TagMod {
@@ -53,6 +55,9 @@ class TagOf[+N <: TopNode] private[vdom](final val tag: String,
5355
5456 override def applyTo (b : Builder ): Unit =
5557 b.appendChild(render.rawElement)
58+
59+ def renderIntoDOM (container : Raw .ReactDOM .Container , callback : Callback = Callback .empty) =
60+ render.renderIntoDOM(container, callback)
5661}
5762
5863// =====================================================================================================================
Original file line number Diff line number Diff line change 1616* ` vdom.TagMod ` now has a ` .toJs ` method which turns the VDOM tree into a bunch of raw JS values.
1717 This is for advanced hackers only.
1818
19+ * Add ` .renderIntoDOM ` to ` VdomElement ` and ` VdomTag ` s.
20+
1921* Opening links in new tabs using ` target="_blank" ` without ` rel="noopener ` is a
2022 [ security risk and performance impediment] ( https://blog.dareboost.com/en/2017/03/target-blank-links-rel-noopener-performance-security/ ) .
2123 Google's Lighthouse auditor [ flags it] ( https://developers.google.com/web/tools/lighthouse/audits/noopener ) .
You can’t perform that action at this time.
0 commit comments