markup-validator icon indicating copy to clipboard operation
markup-validator copied to clipboard

SVG should not require <style type>

Open edemaine opened this issue 5 years ago • 4 comments
trafficstars

The following document produces an error, but I believe it shouldn't.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 300" width="500" height="300" preserveAspectRatio="xMinYMin meet">
  <style>
    * { fill: blue }
  </style>
</svg>

Line 4, Column 9: required attribute "type" not specified in <style> The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element. Typical values for type are type="text/css" for

The SVG 1.1 spec says the following:

type = content-type This attribute specifies the style sheet language of the element's contents. The style sheet language is specified as a content type (e.g., "text/css"), as per MIME Part Two: Media Types [RFC2046]. If a ‘type’ is not provided, the value of ‘contentStyleType’ on the ‘svg’ element shall be used, which in turn defaults to "text/css" [RFC2046]. If a ‘style’ element falls outside of the outermost svg element and the ‘type’ is not provided, the ‘type’ must default to "text/css" [RFC2046]. Animatable: no.

So it seems that SVG 1.1 has a default <style type>, so there shouldn't be an error in this case.

edemaine avatar May 06 '20 21:05 edemaine

Note that as an alternative, you can use https://validator.w3.org/nu/ for checking SVG documents.

You can give that the URL for an SVG document to check, or upload an *.svg file to check.

As far as the legacy https://validator.w3.org/ markup validator, at this point, there’s basically nobody working on it any longer — not even for bug fixes.

These days all the active work is on the https://validator.w3.org/nu/ checker, and that work takes place in the https://github.com/validator/validator repo.

The SVG checking there is kept more up to date, and it has a number of bug fixes for SVG checking which the legacy markup validator doesn’t have.

sideshowbarker avatar May 07 '20 00:05 sideshowbarker

Oh, thanks, I hadn't realized! Perhaps it would help to add a clear "recommend you go here instead" link to the nu validator from https://validator.w3.org/? (It is available indirectly via the "other validators and tools" link.) It's pretty common to end up here via Google search or those of us who remember this URL by heart...

edemaine avatar May 07 '20 00:05 edemaine

Yeah, I will make time to get something like that added to https://validator.w3.org/

(Actually it’s probably time that we finally just take the https://validator.w3.org/nu/ UI and backend and move it to https://validator.w3.org/ — and then move what’s currently at https://validator.w3.org/ to become https://validator.w3.org/legacy/ or such. That’s a bigger deal to make happen, and I’ve been lazy about even making time to start the necessary internal conversations. But I guess it’s time I quit procrastinating on it…)

sideshowbarker avatar May 07 '20 01:05 sideshowbarker

Yeah, I will make time to get something like that added to https://validator.w3.org/

(Actually it’s probably time that we finally just take the https://validator.w3.org/nu/ UI and backend and move it to https://validator.w3.org/ — and then move what’s currently at https://validator.w3.org/ to become https://validator.w3.org/legacy/ or such. That’s a bigger deal to make happen, and I’ve been lazy about even making time to start the necessary internal conversations. But I guess it’s time I quit procrastinating on it…)

Any update on this @sideshowbarker? I had to jump through many issues and pull requests to find these comments that the validator is basically a deprecated legacy validator. I think it would be a good idea to just add one simple sentence to the live website at https://validator.w3.org/ explaining this, and linking to https://validator.w3.org/nu/.

I'm also curious how https://validator.w3.org/nu/ compares to https://validator.nu/. I've read the About pages on both sites and can't really make sense of it. What are the differences?

MarcusOtter avatar Apr 04 '21 22:04 MarcusOtter