I ran my website through Validator and it returned two errors, both of which relating to the official Twitter follow button code.
The code for the larger button is:
Follow #gary
<script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
Validator returned these errors when checking my site as XHTML 1.0 Transitional:
there is no attribute "data-show-count"
and
there is no attribute "data-size"
So what is the deal here? Obviously these two attributes exists. Removing the data-size will return the smaller version of the button.
It should work with HTML5 Doctype.
Related
I am using the w3 include for my footer on each page. The pages loads fine and everything works great except when I run the code through https://validator.w3.org/ for validation I am getting this error:
"Error: Attribute w3-include-html not allowed on element div at this point."
<!--FOOTER-->
<div w3-include-html="../includes/footer.html"></div>
<!--Include HTML Files-->
<script>
w3.includeHTML();
</script>
Is the w3 include not widely supported? Should I be doing this with PHP or asp.net? or ajax?
You are probably using a script offered by w3schools.com. Note that w3schools has nothing to do with W3C. It’s just a custom JavaScript that makes use of an invalid attribute which likely gets replaced after the JS got executed.
The W3C HTML validator doesn’t execute JavaScript, so it doesn’t see the document after the JS replaced the attribute.
Possible solutions:
If you want to validate your HTML after the JavaScript got executed, you could open your page in a browser, mark everything, open the source code for the selection, and copy-paste this markup into the W3C validator.
If you just want to have a valid document before/without executing the JavaScript, you could change the script to use a data-* attribute, e.g., data-include-html.
If you want to support users and bots/services that don’t execute JavaScript, you shouldn’t rely on JavaScript. Using a server-side programming language (like PHP) could help here, but (depending on your use case) you could also just generate plain static HTML files, e.g., with the help of a static site generator.
To build a very simple web app for my company I'm evaluating some web frameworks, including PrimeFaces.
One strict requirement is the accessibility, and the fact that the HTML must be valid (checked against W3C Validator).
I've played a bit with the examples and I've noticed that the HTML rendered is not valid. The invalid block is the following:
<input name="javax.faces.ViewState" id="javax.faces.ViewState" value="2042368857675116551:8104174386673838460" autocomplete="off" type="hidden">
and the reason is:
line 74 column 159 - Errore: Attribute autocomplete not allowed on element input at this point.
So, can I perform some action on Primefaces in order to render valid HTML code? I didn't go deep into Primefaces, but I guess I have little control over how controls are rendered. Has anyone experience on this problem (validity of HTML rendered by PF) and would like to share it?
Thanks
The viewstate is not something that PrimeFaces adds to your rendered html but the jsf implementation. If you use mojarra there are some parameters that you can set to tune things (not tested this myself, just did some simple googling for you (hint, hint)).
See in How to let JSF render conform XHTML 1.0 strict?
I'm using the HTML Validator firefox add-on and when I go to the home page of http://knockoutjs.com/, I get warnings about the data-bind attribute (for the Live Example):
Examples:
<select> proprietary attribute "data-bind"
<button> proprietary attribute "data-bind"
I also get errors regarding the data-bind attribute when submitting the URL at http://validator.w3.org/.
I know this html attribute is used by knockout.js to do some data binding, but can we conclude that this approach does not follow the HTML specification? Does knockout.js follow the spirit of valid HTML markup?
They are HTML 5 custom attributes. Try to validate against HTML 5 specs and you should get an ok on the validation.
But since long you have been able to use custom attributes as you see fit although it may have violated strict HTML 4 specs.
When I read the documentation on Common-Tags, I thought it would be easy to put this in a jsp because the examples were cut and paste
<body xmlns:ctag="http://commontag.org/ns#" rel="ctag:tagged">
<span typeof="ctag:Tag"
rel="ctag:means"
resource="http://rdf.freebase.com/ns/en.u2"
property="ctag:label" content="U2"/>
</span>
</body>
It's a good thing that we're using Eclipse in our dev work. It's telling us that something is wrong with our markup. It's underlining the common-tags markup with yellow returning:
Undefined attribute name
What am I missing here? or is this completely okay?
The typeof, resource and property attributes are extensions to XHTML which are part of the RDFa specification which is why Eclipse doesn't know about them.
Since RDFa+XHTML is now a W3C recommendation this is absolutely fine to use as is.
http://www.w3.org/TR/rdfa-syntax/#rdfa-attributes
I assume you're not sending your pages with an XML MIME type, because that snippet isn't well-formed. Using RDFa isn't allowed when using a text/html MIME type. For an alternative, have a look at "microdata".
I've build a website for a client and as we all know 'it works just fine on my machine' :-) as it does on several machines at my clients location. But they have (so far) 3 pc's on wich some errors occur, like cannot find ElementById. These machines are normal up-to-date windows machines running IE8.
When comparing the html-source of the page on my machine with one of a machine on wich the error occurred I found that there seems to be a s--tload of html injected. Loads of DIVS and SPAN around attributes and elementID's and even javascript :
Normal:
<script type="text/javascript" language="JavaScript">
After injection:
script will be surrounded with a SPAN tag using class 'HTML_ELM'
type will be surrounded with a SPAN tag using class 'HTML_ATR'
"text/javascript" will be surrounded with a SPAN tag using class 'HTML_VAL'
<<span class="HTML_ELM">script</span> <span class="HTML_ATR">type</span>=<span class="HTML_VAL">"text/javascript"</span> <span class="HTML_ATR">language</span>=<span class="HTML_VAL">"JavaScript"</span>>
even ID's of html elements are surrounded with these SPAN tags (class='JS_STR') probably causing the problem of cannot find ElementById
I have no idea why this is happening, I also cannot find a cause on Google when searching for these weird classnames used by the injected SPAN/HTML tags (HTML_VAL, HTML_ELM, HTML_VAL).
Does anyone here know what could be causing this ?
many thanks,
Jurjen.
Well, since you are running IE8, are some of the machines in compatibility mode?
This extra code comes from the IE8 source viewer. In IE8, if you view source and go to the File menu there are two options under Save, HTML Source and Formatted HTML View. The Formatted HTML View contains all the extra code you are seeing.
Do your HTML files start with a valid DTD ?
like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Try running it through html-tidy.
An online tidier can be found at http://infohound.net/tidy/.
Then, it'll be easier to track down the problem. It sounds like malformed html.
Googling span class=HTML_ELM returns lots of results but they've got nothing much in common.
You don't have a syntax highlighter script (or something similar) running on the site by any chance?