title: Why does HTML Canvas rounded lineCap fail for last segment?
body: <p>With the HTML Canvas if you draw a dotted line like this:</p>
  
  <pre><code>ctx.lineWidth   = 40;
  ctx.lineCap     = 'round';
  ctx.strokeStyle = 'red';
  
  ctx.beginPath();
  ctx.moveTo(100,100);
  ctx.lineTo(150,200);
  ctx.moveTo(200,300);
  ctx.lineTo(250,400);
  ctx.moveTo(300,500);
  ctx.lineTo(350,600);
  ctx.closePath();
  ctx.stroke();
  </code></pre>
  
  <p>then the result is this:</p>
  
  <p><a href="https://i.stack.imgur.com/41NMK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/41NMK.png" alt="Dashed line with first two dashes using rounded line caps and last dash using butt caps"></a><br>
  <sub>(source: <a href="http://phrogz.net/tmp/canvas_broken_rounded_stroke.png" rel="nofollow noreferrer">phrogz.net</a>)</sub>  </p>
  
  <p>As you can see on <a href="http://phrogz.net/tmp/canvas_broken_rounded_stroke.html" rel="nofollow noreferrer">this test page</a>, adding a "superfluous" <code>moveTo</code> call after the last <code>lineTo</code> fixes the last line segment to use rounded caps.</p>
  
  <p>I was prepared to file this as a bug, but then I found that the behavior is identical on Safari v5, Chrome v8, and FireFox v3.6 and v4.0b. This leads me to believe that it is intentional.</p>
  
  <p><strong>Where in the standard is this behavior specified, and (if you can discern it) why was it specced as such?</strong></p>