scaladget icon indicating copy to clipboard operation
scaladget copied to clipboard

selection.node() always returns null

Open akarasev opened this issue 8 years ago • 4 comments

Using:

"fr.iscpif" %%% "scaladget" % "0.7.0"

I want to obtain a DOM element as a result of D3 selection. For example,

d3.select("body").node()

but the result is always null. However, I'd like to get HTMLBodyElement for that example.

akarasev avatar Mar 12 '16 09:03 akarasev

Hi, you can use d3.select and compose on it. An example here: https://github.com/mathieuleclaire/scalaWUI/blob/master/client/src/main/scala/fr/iscpif/client/FlowChart.scala#L56-L60

mathieuleclaire avatar Mar 12 '16 10:03 mathieuleclaire

Ok, I can. But try to get a node svg.node() and you will get a null

akarasev avatar Mar 12 '16 10:03 akarasev

I don't know D3 a lot, but it does not seem to be a proper way to use it. If you just want to get the body node, why not use scalajs-dom instead and invoke dom.document.body ?

mathieuleclaire avatar Mar 12 '16 10:03 mathieuleclaire

I don't want to get document body exactly. It was just an example of incorrect behavior. I am trying to tell you, that a method node() doesn't work properly.

I have to use scaldget in my project, but I compared scaladget with an another D3 facade and that facade works fine.

akarasev avatar Mar 12 '16 11:03 akarasev