I did use foreignObject, but bumped into a bug in Webkit where (if I remember correctly) using it was crashing if the object coordinates were not in absolute position from the main HTML frame
(if you search in Google for "
foreignObject Webkit crash” you’ll get some references).. So if the object is appearing/disappearing and is not “always on the screen” this requirers an additional bits of manipulation.
Otherwise it was pretty simple with code like
svgContainer.append("foreignObject").attr("x",this.inspectorX+startX).attr("y",this.inspectorY+startY).attr("width",140).attr("height",40).attr("id","XtagValueInput").append("xhtml:form").append("xhtml:input").attr("type","text").attr("id","tagValueInput").on("click", function(d,i) {d3.event.stopPropagation();});
laurent