Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG should not require <style type> #46

Open
edemaine opened this issue May 6, 2020 · 4 comments
Open

SVG should not require <style type> #46

edemaine opened this issue May 6, 2020 · 4 comments

Comments

@edemaine
Copy link

edemaine commented May 6, 2020

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 <style> and type="text/javascript" for <script>.

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.

@sideshowbarker
Copy link
Contributor

sideshowbarker commented May 7, 2020

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.

@edemaine
Copy link
Author

edemaine commented May 7, 2020

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...

@sideshowbarker
Copy link
Contributor

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…)

@MarcusOtter
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants