Polling SVG TEXT and TSPAN width
✓ Published0🌍 Public
MMSCAU
Last edited May 10, 2014
Created on May 9, 2014
This example compares how different browsers measure SVG text and tspan elements. It uses a table to display results from three APIs: getBBox(), getBoundingClientRect(), and getComputedTextLength(), applied to four elements in a small inline SVG. The code, written in plain JavaScript, reveals that Internet Explorer and Firefox throw errors when calling getBBox on a tspan, while Chrome and Safari return widths, though getBoundingClientRect can produce inconsistent results across browsers for text elements. The visualization is a simple diagnostic tool rather than a data-driven chart.
AI-generated description