Fixing issue #136. Improved logic in tooltip.js for handling <svg> and <g> tags.