networkD3 icon indicating copy to clipboard operation
networkD3 copied to clipboard

Sankey: explicit <xhtml:pre> instead of <xhtml:body> for bootstrap-datepicker compatibility

Open octaviancorlade opened this issue 7 years ago • 4 comments

Removes the necessity of declaring a new namespace for each

using the <span>xhtml:body</span> tag, since there is only one <span>xhtml:pre</span> for each title in any case. <p>Working on Chrome 60.0.3112.113, FF 55.0.3, Safari 10.1.2, IE11.</p> <p>Fixes #214</p>

octaviancorlade avatar Sep 10 '17 16:09 octaviancorlade

Just to keep track of what was found with some more testing (see comments on Issue #214):

No reason to use xhtml:pre instead of pre, since the namespace is removed in d3.selection.append() and therefore doesn't affect the result.

No reason to remove the foreignObject tag, which would be semantically more correct.

Just removing the .append("xhtml:body") should be enough.

Consistency in appending .html() or .text() would be a good idea, probably using .text() with \n for new lines is easier inside pre.

octaviancorlade avatar Sep 27 '17 16:09 octaviancorlade

I haven't actually tested this, but based on the discussion and what I know/remember, this gets my seal of approval. Using the <foreignObject> tag I think is necessary for older browser compatibility, but use of the <body> tag, namespaced or not, seems to cause conflicts with other JavaScript packages when they select elements in the DOM.

cjyetman avatar Sep 28 '17 13:09 cjyetman

this would probably fix #250 as well

cjyetman avatar Feb 15 '19 23:02 cjyetman

The problem that this was intended to workaround has been fixed upstream in shiny, so I'm not sure this needs to be merged anymore. Will leave open for now though as this may be a better strategy than the current one.

cjyetman avatar Apr 09 '19 12:04 cjyetman