Reputation: 245
As per the guidance I have read, in order to add any html elements in D3.JS SVG we need to create ForeignObjects. So I added a tag using foreign object and its working just fine in Chrome. Below is the code I am using.
this.g.append('svg:foreignObject')
.attr('font-size', "15px")
.attr('x', x - 10)
.attr('y', y - 55)
.append("xhtml:div")
.html('<div class="terst">some text</div></div>')
My problem is, it is not rendered in IE and Firefox. Could you please let me know if I miss anything obvious.
Upvotes: 2
Views: 1856
Reputation: 245
After a bit of investigation, have realized ForeignObject is not supported or having issues with IE and Firefox. So decided to change my implementation so it can be supported by all browsers.
Upvotes: -2
Reputation: 124179
Firefox requires foreignObject to have width and height attributes
Upvotes: 3