syntax - Difference between append("svg:g") and append("g") -


i work on d3js project , saw tutorial append("g") , other append("svg:g") without getting difference between both.

in days of d3 required use svg:g syntax because of way svg elements appended dom. later versions of d3 don't require these "hints" insert svg elements, proper way simple g.


the technical details behind rather dull, svg requires namespace, when insert or manipulate svg elements use document.createelementns('a', "http://www.w3.org/2000/svg) white plain html uses document.createelement('a'). since d3 can manipulate both svg , html d3.append('svg:a') way of saying this svg anchor.


Comments