Social Links Menu contains HTML errors (i.e. does not validate)
-
Just updated to latest version of WP and twenty seventeen. Made some changes to my child theme and decided to check the html using https://validator.w3.org. It returned several errors relating to the theme’s built-in Social Links Menu. For example:
Attribute href not allowed on element use at this point. <use↩href="#icon-youtube" xlink:href="#icon-youtube"></use>There were similar errors for all my other social media links (Facebook, G+, Twitter etc.) as well as “#icon-arrow-left” and “#icon-arrow-right” (i.e. next and previous page links).
Am I the only one getting these validation errors or is this a bug?
I did check, and the errors occur on both my child and parent theme. I included a link to a sample page but the errors occur in all of my pages, including the blog homepage, https://santa-claus-blog.emailsanta.com.
Thank you for your help and Merry Christmas!
KringleP.S. FWIW, there are also numerous warnings about the “type” not being required for the script tag:
<script type='text/javascript'
Don’t know if anyone wants to tidy up the code for that.The page I need help with: [log in to see the link]
-
Looking at the W3C documentation on the ‘use’ and ‘script’ element, it seems the W3C is out-dated and the validator does not conform to current web standards.
If in doubt, search the Mozilla Web Docs for guidance https://developer.mozilla.org/en-US/
Thanks for the quick reply!
Hmm, can’t speak to ‘use’ at the moment, but “Authors should omit the [mime-type] attribute” since HTML5. See https://www.w3.org/TR/html5/semantics-scripting.html#element-attrdef-script-type
There’s some background at https://stackoverflow.com/questions/2267476/html-script-tag-type-or-language-or-omit-both.
It’s a simple & low priority fix, but still important I think given the quantity of websites using WP sending out the unnecessary code. Not to mention SEO considerations given Google’s nit-picking.
Digging some more,
Since SVG 2, the xlink:href attribute is deprecated in favor of simply href.
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/use. Perhaps this should be removed as well in a future release? Is this the place to make such a suggestion?
It’s unclear to me now whether the W3 Validator error is regarding the xlink:href or the href attribute. I would still assume the latter as the former would only be a warning similar to the mime-type issue previously discussed.
The topic ‘Social Links Menu contains HTML errors (i.e. does not validate)’ is closed to new replies.
