SuperTinyIcons icon indicating copy to clipboard operation
SuperTinyIcons copied to clipboard

problem with svg validation test

Open btrem opened this issue 1 year ago • 2 comments

PR #784 test failed. Specifically the reference image reportedly failed validation:

  1. apple_podcasts.svg should be validated by the w3c validator: AssertionError: expected ':5.54-5.81: error: SVG element “stop”…' to be empty at /home/runner/work/SuperTinyIcons/SuperTinyIcons/test/test.js:34:38

The problem appears to be that the reference image uses <stop></stop> instead of <stop/>. But those two constructs should be treated as equivalent. The W3C validator at https://validator.w3.org/ reports that the svg is, in fact, valid.

I checked test.js. It appears to use the W3C's nu validator:

it("should be validated by the w3c validator", async () => {
            await fetch("https://validator.w3.org/nu/?out=gnu", {
                    method: "POST",

I note that the NU validator advertises itself as "an ongoing experiment in better HTML checking." So maybe it's not parsing the xml/svg correctly?

btrem avatar Jan 06 '24 22:01 btrem

Reference images aren't being validated, so the issue is in your apple_podcasts.svg file. Line 5, columns 54-81 are the first stop tag in your file, so something's wrong there. I believe the issue is that the offset property is not required in SVG 2, but it is required in SVG 1.1 (assumed default).

Eiim avatar Jan 07 '24 18:01 Eiim

Thanks for the reply. The validation message was rather unclear to me. After reading your reply, I now realize the numbers in the message are a reference to the line and character.

Further confusing things, I had trouble with the w3c validator. If one submits my code via file upload or uri -- and uri is the method that SuperTInyIcons' test script uses -- it is validated as SVG 1.1 + URL + HTML + MathML 3.0, and produces the missing attribute error. But I used the direct input method, and in that case, the service validates it as xml and it passes. It took some time to notice the different parsing/validation.

I'm not sure if that is by design or necessity, but I've filed an issue in the w3c validator repo.

btrem avatar Jan 09 '24 01:01 btrem