Unclosed SVG path appears to be closed

Solution 1:

The relevant line from the SVG specification, regarding filling paths:

The fill operation fills open subpaths by performing the fill operation as if an additional "closepath" command were added to the path to connect the last point of the subpath with the first point of the subpath.

So, as far as the fill is concerned, there's an implicit "Z" at the end. However, for the stroke, there's no implied closure, so it won't draw a stroke connecting the last point to the first point unless you explicitly add a "Z".

If you only want to apply a stroke, use CSS to disable the fill:

path {
  fill: none;
  stroke: #000;
  stroke-width: 1.5px;
}

(I see you answered your own question, but I thought others might still find an explanation useful.)

Solution 2:

I up-voted the answer, but sometimes css is not an option when you try to convert the svg to canvas and would like to prevent the svg path from filling or closing. Equivalent to the css solution but with no css...

<svg fill="white" fill-opacity="0" stroke="#000" stroke-width="1.5">
    <path d="M 40 60 L 10 60 L 40 42.68 M 60 60 L 90 60 L 60 42.68"/>
</svg>