The Mysterious Google Chrome SVG Bug Revisited

December 06, 2010

A previous post outlined the steps I took to track down a bug in Google Chrome that prevented the firing of mouse events on certain SVG elements. After filing a bug report, one commenter suggested that I create a single file that illustrates the bug, rather than a full Google Closure project.

That's exactly what I did. You can view the test page here. In addition to major simplification, this demo shows that the Chrome SVG event bug also affects event firing from rectangles as well ellipses. Here's the source:

<html xmlns="">
  <title>Chrome on Linux/Windows SVG Event Bug</title>
      p { width: 600px; line-height: 1.5em; }
      svg { width: 600px; height: 200px;}
      function enter(event) {"fill", "#22AA00");
      function exit(event) {"fill", "#AA2222");
    <svg xmlns="">
      <g transform="translate(0, 200) scale(100, -100)">
        <ellipse cx="1" cy="1" rx="0.75" ry="0.75" fill="#AA2222" onmouseover="enter(evt)" onmouseout="exit(evt)" />
        <ellipse cx="3" cy="1" rx="0.2" ry="0.2" fill="#AA2222" onmouseover="enter(evt)" onmouseout="exit(evt)" />
        <rect x="4" y="0.9" width="0.2" height="0.2" fill="#AA2222" onmouseover="enter(evt)" onmouseout="exit(evt)" />
      Hover the mouse cursor over all three shapes. Each shape should change its color from red to green.
      This test works on all recent SVG-enabled browsers, but fails in Google Chrome 8.0.552.215 on Linux and Windows.
      On Chrome for Linux and Windows, the smaller circle and square on the right don't turn green. On Chrome for OS X, all
      three shapes turn green, which is the expected behavior.
      For details, see <a href="">this bug report</a>
      and <a href="">this writeup</a>.

This demo creates a transformed SVG coordinate space, populates it with three shapes, and assigns two event listeners, enter and exit, to respond to mouse events by changing the shapes' fill colors.

Update 12/06/2010 Fixed onmouseover/onmouseout attributes in demo code.