Markup_validation.xhtml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /**
  3. * <https://y.st./>
  4. * Copyright © 2017 Alex Yst <mailto:copyright@y.st>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org./licenses/>.
  18. **/
  19. $xhtml = array(
  20. 'title' => 'Markup validation',
  21. 'subtitle' => 'Written in <span title="Web Programming 1">CS 2205</span> of <a href="http://www.uopeople.edu/">University of the People</a>, finalised on 2017-09-13',
  22. 'copyright year' => '2017',
  23. 'body' => <<<END
  24. <p>
  25. The main tool I used to use for markup validation was the $a[W3C]&apos;s <a href="https://validator.w3.org/">main validation tool</a>.
  26. However, that tool has some issues.
  27. First, it cannot load pages from servers that make use of $a[SNI].
  28. I&apos;m not sure why not, as servers that support $a[SNI] tend to also accept requests without it, so it baffles me that this validation tool somehow chokes when it comes to those servers.
  29. Second, this tool doesn&apos;t handle $a[HTML]5 or $a[HTML] 5.1, and can only validate pages written in an older version of $a[HTML] or $a[XHTML].
  30. Now, I instead use their experimental <a href="https://validator.w3.org/nu/">Nu validator</a>.
  31. </p>
  32. <h2><a href="https://validator.w3.org/nu/?useragent=Validator.nu%2FLV+http%3A%2F%2Fvalidator.w3.org%2Fservices&amp;acceptlanguage=&amp;doc=https%3A%2F%2Fwww.uopeople.edu%2F">University of the People&apos;s website</a></h2>
  33. <p>
  34. Our university is teaching us the importance of Web standards, so you&apos;d think their own website would pass inspection, right?
  35. Nope.
  36. Most websites aren&apos;t properly written, and University of the People&apos;s is no exception.
  37. </p>
  38. <p>
  39. The main error present is the lack of an <code>alt</code> attribute on several <code>&lt;img/&gt;</code> tags.
  40. This attribute is <strong>*mandatory*</strong> for most <code>&lt;img/&gt;</code> tags.
  41. I thought <strong>*all*</strong> <code>&lt;img/&gt;</code> tags required it, but according to the validator, there are some cases in which they&apos;re not needed.
  42. However, the missing attribute in these <code>&lt;img/&gt;</code> tags isn&apos;t one of those cases; otherwise the validator wouldn&apos;t be throwing errors.
  43. This is a pretty common mistake made on the Web.
  44. Another common theme in the error list is the presence of <code>&lt;div/&gt;</code> tags nested within <code>&lt;h1/&gt;</code> and <code>&lt;h2/&gt;</code> tags.
  45. <code>&lt;h1/&gt;</code> and <code>&lt;h2/&gt;</code> tags are supposed to contain inline elements, not block elements, so <code>&lt;div/&gt;</code> tags don&apos;t belong there.
  46. Some <code>&lt;h2/&gt;</code> tags are nested within <code>&lt;span/&gt;</code> tags as well, causing more errors.
  47. Like <code>&lt;h1/&gt;</code> and <code>&lt;h2/&gt;</code> tags, <code>&lt;span/&gt;</code> tags contain only inline elements.
  48. While <code>&lt;h1/&gt;</code> and <code>&lt;h2/&gt;</code> tags <strong>*contain*</strong> inline elements, they <strong>*are*</strong> block elements, so they don&apos;t belong within a <code>&lt;span/&gt;</code> tag.
  49. In general, the home page of the university shows a frequent misuse of heading tags.
  50. A <code>&lt;style/&gt;</code> tag is also out of place, being in the <code>&lt;body/&gt;</code> instead of the <code>&lt;head/&gt;</code>.
  51. The <code>&lt;meta/&gt;</code> tag has an invalid <code>content</code> attribute value, and the deprecated <code>border</code> attribute is used in a couple places.
  52. The validator presents a few non-error warnings worth taking into consideration as well.
  53. The language of the document isn&apos;t specified in the <code>&lt;html/&gt;</code> tag&apos;s <code>lang</code> attribute, the page disables user zooming, and one of the headings is empty.
  54. In general, this is a pretty messy page.
  55. I will say this though: at least the page appears to be well-formed, which I wasn&apos;t expecting.
  56. Tags and attributes are misused and misplaced, but there are no syntax errors.
  57. </p>
  58. <p>
  59. Aside from the validator errors and warnings, I&apos;d say the main thing that doesn&apos;t work well on the page is the use of JavaScript to run the videos.
  60. Videos are plenty capable of running on a webpage without JavaScript, and requiring JavaScript makes the page less accessible to people with different browser set-ups.
  61. Other than that, the page seems to be in good working order to me.
  62. </p>
  63. <h2><a href="https://validator.w3.org/nu/?useragent=Validator.nu%2FLV+http%3A%2F%2Fvalidator.w3.org%2Fservices&amp;acceptlanguage=&amp;doc=http%3A%2F%2Ffloraverse.com%2F">Floraverse</a></h2>
  64. <p>
  65. Floraverse is one of two comics I read, the other being one that updates so infrequently that I never know when to expect a new page.
  66. I wasn&apos;t expecting it, but their markup is incredibly clean.
  67. They do have one reoccurring error though: missing <code>alt</code> attributes on their <code>&lt;img/&gt;</code> tags.
  68. Again, this is an incredibly common error and most people don&apos;t seem to realise that the <code>alt</code> attribute isn&apos;t optional, but <strong>*mandatory*</strong>.
  69. The validator also throws out some warnings requesting heading tags be used within the <code>&lt;section/&gt;</code> elements, but these are just very good suggestions and not requirements.
  70. </p>
  71. <p>
  72. The comments section doesn&apos;t function without JavaScript, though.
  73. This is a big accessibility problem.
  74. Additionally, the heavy use of images makes non-graphical browsing of the site pointless.
  75. That said, it&apos;s a Web comic.
  76. What can you expect?
  77. The comments section should be cleaned up, but as for the heavy image use, it&apos;s sort of the whole point of the site.
  78. There&apos;s no need to fix that, aside from adding <code>alt</code> attributes where they belong.
  79. </p>
  80. <h2><a href="https://validator.w3.org./nu/?useragent=Validator.nu%2FLV+http%3A%2F%2Fvalidator.w3.org%2Fservices&amp;acceptlanguage=&amp;doc=https%3A%2F%2Fy.st.%2F">My own website</a></h2>
  81. <p>
  82. We can&apos;t discuss website validation without considering the validation of our own websites.
  83. Personally, I&apos;m a stickler for standards, and as a result, my website&apos;s markup is flawless.
  84. In fact, every page of my website has a link in the footer to the $a[W3C] validator with the appropriate query string to tell the validator to display the validation results for that particular page.
  85. The validator has neither any errors nor any warnings to present.
  86. </p>
  87. <p>
  88. I also do my best to make my site incredibly accessible.
  89. I use a very simple layout.
  90. There&apos;s a little JavaScript, but the site works perfectly well without it; the JavaScript&apos;s just a navigation aid, allowing the user to use the left and right arrow keys on certain pages to load the previous and next pages, respectively.
  91. Even if JavaScript&apos;s disabled though, it works because actual <code>&lt;a/&gt;</code> tags are provided in the navigation menu to get to both adjacent pages (in fact, the JavaScript is set up to read the $a[URI]s from those tags to know where to send the user, so the content of those tags is identical to what the user gets from the JavaScript).
  92. That doesn&apos;t mean my site&apos;s without issue though.
  93. There are at least two problems.
  94. Most noticeably, the site makes use of a $a[TLS] certificate issued by a certificate &quot;authority&quot; blacklisted by Mozilla.
  95. Mozilla-based browsers therefore refuse to load my website at all.
  96. However, I can&apos;t afford a commercial $a[TLS] certificate, so I don&apos;t have any option to replace it until I find another certificate &quot;authority&quot; that gives out decent and gratis certificates.
  97. Most browsers offer you a way to bypass the certificate issue if you choose to, but Mozilla-based browser refuse to provide this option for websites using certificates issued by my provider.
  98. This is a problem in Mozilla-based browsers, not my website, and there&apos;s nothing I can do about it.
  99. The second issue is triggered by a bug in some browsers.
  100. Some browsers ignore the <code>Content-Type</code> header, and in doing so, assume my pages are written in $a[HTML] of some sort.
  101. They&apos;re not.
  102. They&apos;re written in $a[XHTML] 5.1.
  103. When rendered as $a[HTML], my pages appear blank; they <strong>*must*</strong> be rendered in $a[XHTML] to display their content properly.
  104. This is an uncommon bug though, and I&apos;ve only heard of it happening in old versions of the Links browser.
  105. Other browsers and newer versions of that browser don&apos;t have that problem.
  106. </p>
  107. END
  108. );