Skip to content

Flag SVG tags as proprietary in HTML 4.01 documents #909

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

Open
cqcallaw opened this issue Nov 20, 2020 · 5 comments
Open

Flag SVG tags as proprietary in HTML 4.01 documents #909

cqcallaw opened this issue Nov 20, 2020 · 5 comments

Comments

@cqcallaw
Copy link
Contributor

cqcallaw commented Nov 20, 2020

Per some discussion in issue #903, it's been determined that svg tags should be flagged as proprietary in HTML 4.01 documents.

Rationale: the W3C validator does not accept the svg tag in HTML 4.01 documents. According to Wikipedia, SVG 1.0 become an official recommendation in 2001, whereas HTML 4.01 was officially recommended in 1999.

@geoffmcl
Copy link
Contributor

@cqcallaw thank you for opening this issue...

the W3C validator accepts the svg tag in HTML 4.01 documents

I am still unable to construct a legacy doc, with the svg tag, that is accepted by the validator... do you have a sample?

While your/our assessment, based on the dates, seems correct, still seek further, definitive, W3C references on this... namely svg in legacy HTML documents... any pointers appreciated...

Look forward to feedback, suggestions, patches, etc... thanks...

@cqcallaw
Copy link
Contributor Author

Hmm, I seem to have been mistaken; I can't get a document that validates with the svg tag either. I'll update my issue description.

@geoffmcl
Copy link
Contributor

@cqcallaw thanks for the further feedback... months ago...

Ok, since we can not produce a legacy document, passable in the W3C validator, with <svg>, is there still an issue here?

Athough in constructing a legacy document like the following, tidy changes the DOCTYPE to <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">, without any warning/error ... UGH!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
           "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Is. #903-1 legacy</title>
</head>
<body>
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" stroke-width="2" stroke-linecap="butt" stroke-linejoin="round" stroke-miterlimit="4" stroke-opacity="1" stroke-dasharray="none" fill="currentColor" stroke="currentColor">
            <path d="m 0.75,12.0 11.25,-9.0 4.5,3.375 0.0,-1.5 2.25,0.0 0.0,3.375 4.5,3.75 -2.25,0.0 0.0,9.0 -5.625,0.0 0.0,-7.5 -6.75,0.0 0.0,7.5 -5.625,0.0 0.0,-9.0 z" />
        </svg>
</body>
</html>

But both the above in and tidy out documents, fail the W3C validator, so there still seems to be a problem, or 2... but difficult to nail it down, and choose what tidy should do...

Changing the DOCTYPE to HTML5, and fixing the meta tag, and it passes nu, as it does in tidy...

Of course the chrome browser is no help, in that it produces the image in ALL cases ;=/

Look forward to further comments... thanks...

@cqcallaw
Copy link
Contributor Author

Don't we still have an issue, because tidy fails to flag <svg> tags as proprietary in HTML 4.01 documents? As I understand it, tidy's behavior isn't consistent with the W3C validator or the HTML 4.01 spec.

@geoffmcl
Copy link
Contributor

@cqcallaw thank you for the further feedback...

Yes, certainly agree we still have an issue, or 2!

My first attempt was the remove the legacy doc support for <svg>, with the simple patch -

diff --git a/src/tags.c b/src/tags.c
index 70fb5ac..2864ebf 100644
--- a/src/tags.c
+++ b/src/tags.c
@@ -110,7 +110,7 @@ static CheckAttribs CheckHTML;
 #define VERS_ELEM_STYLE      (xxxx|HT32|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|xxxx|HT50|XH50)
 #define VERS_ELEM_SUB        (xxxx|HT32|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|xxxx|HT50|XH50)
 #define VERS_ELEM_SUP        (xxxx|HT32|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|xxxx|HT50|XH50)
-#define VERS_ELEM_SVG        (xxxx|xxxx|xxxx|H41T|X10T|xxxx|H41F|X10F|xxxx|H41S|X10S|XH11|xxxx|HT50|XH50)
+#define VERS_ELEM_SVG        (xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|HT50|XH50)
 #define VERS_ELEM_TABLE      (xxxx|HT32|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|XB10|HT50|XH50)
 #define VERS_ELEM_TBODY      (xxxx|xxxx|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|xxxx|HT50|XH50)
 #define VERS_ELEM_TD         (xxxx|HT32|H40T|H41T|X10T|H40F|H41F|X10F|H40S|H41S|X10S|XH11|XB10|HT50|XH50)

But that did nearly nothing, except, in my above sample, tidy output retained the 4.01 doctype, which seems a step in the right direction... but no warning/error emitted???

If I added the option --strict-tags-attributes yes I do get a new warning <svg> element not available in HTML 4.01 Transitional, as well as many warnings for the attributes, like <svg> attribute "xmlns" not allowed for ..., etc, also issued by current tidy, with this option added...

So, maybe the above patch solves it enough?

But somehow, I would like see that new warning whether the user adds the strict option, or not!

Likewise, if I add say <article>article</article>, or any of the many other new HTML5 elements, to the above legacy sample, I get no warning without the strict option on... It seems wrong that default tidy signals these as good, valid, documents!

Looking back in git log history, it seems when this strict-tags-attributes was added circa 2016, commit 429703d, it defaulted to yes, but was later changed to no, commit c62127b, due perhaps mainly due to the yes causes a number of regression tests to fail...

Maybe this can be revisited, and there seems an open issue #688, and maybe #729, and maybe others, about some of this...

What do you, or others, think, having regard for the fact that we probably should not spend too much time on legacy docs in 2021 onwards? But maybe granddaddy tidy should care!

Look forward to further feedback... thanks...

@geoffmcl geoffmcl added the Bug label Feb 18, 2021
@balthisar balthisar added this to the 5.9 milestone Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants