Warning about self-closing syntax in embedded SVG within HTML file




The validators (old and nu) now provide a warning against the use of the self-closing syntax. This is fine for void elements like <br> or <meta>.

But should it also warn against self-closing syntax within SVG that is directly embedded within the HTML (not a separate SVG file linked using <img>)?

This snippet generates warnings. Is this expected behaviour? It is not the same as recommending the removal of a / from an HTML void element.


<dl>
<dt>Example</dt>
<dd>Added diagrams illustrating inclusion/exclusion of Countries, Regions within &lt;SalesRights>, sequencing of &lt;PublishingStatus> and &lt;ProductAvailability> codes. Note these diagrams use embedded SVG, and will show only in very modern browsers.<br>
<svg id="introduction_history_diagram" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" image-rendering="auto" color-rendering="auto" color-interpolation="auto" shape-rendering="auto" fill-opacity="0.5" fill="none" stroke="black" stroke-linecap="square" stroke-dasharray="none" stroke-dashoffset="0" stroke-linejoin="miter" stroke-miterlimit="10" stroke-opacity="1" text-rendering="auto" font-size="14" height="13" width="25">
<g transform="scale(0.15)" stroke-width="6.5">
<title>Spectacles</title>
<!-- arms -->
<path d="M 5 35 l 60 -25 10 5 5 10" />
<path d="M 75 55 l 60 -25 10 5 5 10" />
<!-- lenses -->
<ellipse fill="#aaf" cx="20" cy="40" rx="15" ry="20" />
<ellipse fill="#aaf" cx="60" cy="60" rx="15" ry="20" />
<!-- bridge -->
<line x1="20" y1="20" x2="60" y2="40" />
</g>
</svg>
If no ‘spectacles’ image is visible here, the diagrams will not display.
</dd>
</dl>


Or is the recommendation to use this?

<path d="M 5 35 l 60 -25 10 5 5 10"></path>


Graham Bell



Graham Bell
Executive Director, EDItEUR
United House
North Road
London N7 9DP

Tel: +44 20 7503 6418

The information contained in this e-mail is confidential and may be privileged. It is intended for the addressee only. If you are not the intended recipient, please inform the sender and delete this e-mail immediately. The contents of this e-mail must not be disclosed or copied without the sender's consent. We cannot accept any responsibility for viruses, so please scan all attachments. The statements and opinions expressed in this message are those of the author and do not necessarily reflect those of the company.

EDItEUR Limited is a company limited by guarantee, registered in England no 2994705. Registered Office: United House, North Road, London N7 9DP, UK. The EDItEUR office at United House is currently partly open, but staff are frequently working from home. Website: https://www.editeur.org

Received on Tuesday, 27 September 2022 08:21:00 UTC